Skip to content

Commit 2fdba8f

Browse files
committed
Apply RSPEC-6112 over the whole repository
1 parent 4ee40fd commit 2fdba8f

File tree

214 files changed

+956
-983
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+956
-983
lines changed

_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/osgi/BundleController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public Bundle getBundle(String location) {
168168
@Override
169169
public ServiceReference<?>[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
170170
//Filters are based on class names
171-
String interfaceClassName = (null == clazz) ? filter : clazz;
171+
var interfaceClassName = (null == clazz) ? filter : clazz;
172172
return services.getReferences(interfaceClassName);
173173
}
174174

_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/osgi/ResourceAccessor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class ResourceAccessor {
6363
/** Resources are located in the JAR of the given class
6464
* @throws BundleException */
6565
ResourceAccessor(Class<?> clazz) throws BundleException {
66-
String bundleObjPath = clazz.getName();
66+
var bundleObjPath = clazz.getName();
6767
fatJarResourcePath = bundleObjPath.substring(0, bundleObjPath.lastIndexOf('.'));
6868
try {
6969
bundleFile = getBundlFile(clazz);
@@ -74,7 +74,7 @@ class ResourceAccessor {
7474

7575
private static BundleFile getBundlFile(Class<?> clazz) throws BundleException {
7676
URI objUri = getBundleUri(clazz);
77-
File jarOrDirectory = new File(objUri.getPath());
77+
var jarOrDirectory = new File(objUri.getPath());
7878
if (!(jarOrDirectory.exists() && jarOrDirectory.canRead())) {
7979
throw new BundleException(String.format("Path '%s' for '%s' is not accessible exist on local file system.", objUri, clazz.getName()), BundleException.READ_ERROR);
8080
}
@@ -87,7 +87,7 @@ private static BundleFile getBundlFile(Class<?> clazz) throws BundleException {
8787

8888
private static URI getBundleUri(Class<?> clazz) throws BundleException {
8989
try {
90-
URL objUrl = clazz.getProtectionDomain().getCodeSource().getLocation();
90+
var objUrl = clazz.getProtectionDomain().getCodeSource().getLocation();
9191
return objUrl.toURI();
9292
} catch (NullPointerException e) {
9393
//No bunlde should be used for RT classes lookup. See also org.eclipse.core.runtime.PerformanceStats.
@@ -101,10 +101,10 @@ private static URI getBundleUri(Class<?> clazz) throws BundleException {
101101

102102
/** Get the manifest name from the resources. */
103103
String getManifestName() throws BundleException {
104-
URL manifestUrl = getEntry(JarFile.MANIFEST_NAME);
104+
var manifestUrl = getEntry(JarFile.MANIFEST_NAME);
105105
if (null != manifestUrl) {
106106
try {
107-
Manifest manifest = new Manifest(manifestUrl.openStream());
107+
var manifest = new Manifest(manifestUrl.openStream());
108108
String headerValue = manifest.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
109109
if (null == headerValue) {
110110
throw new BundleException(String.format("Symbolic values not found in '%s'.", manifestUrl), BundleException.MANIFEST_ERROR);

_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/osgi/ServiceCollection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void set(String key, String value) {
7676

7777
@Override
7878
public <S> void add(Class<S> interfaceClass, S service) throws ServiceException {
79-
String className = interfaceClass.getName();
79+
var className = interfaceClass.getName();
8080
if (null != className2Service.put(interfaceClass.getName(), new FrameworkServiceReference<S>(className, service))) {
8181
throw new ServiceException(
8282
String.format("Service '%s' is already registered.", interfaceClass.getName()), ServiceException.FACTORY_ERROR);

_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/runtime/PluginRegistrar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class PluginRegistrar {
3939
private static final String PLUGIN_PROPERTIES = "plugin.properties";
4040

4141
public static BundleException register(Bundle bundle) {
42-
PluginRegistrar registrar = new PluginRegistrar(bundle);
42+
var registrar = new PluginRegistrar(bundle);
4343
try {
4444
registrar.register();
4545
} catch (BundleException e) {

_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/service/SingleSlf4JService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ public long getTime() {
459459

460460
@Override
461461
public String toString() {
462-
StringWriter result = new StringWriter();
462+
var result = new StringWriter();
463463
result.write(message);
464464
if (execption.isPresent()) {
465465
result.write('\n');

_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/service/TemporaryLocation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private TemporaryLocation(Location parent, URL defaultValue) {
4444

4545
private static URL createTemporaryDirectory() {
4646
try {
47-
Path location = Files.createTempDirectory(TEMP_PREFIX);
47+
var location = Files.createTempDirectory(TEMP_PREFIX);
4848
return location.toUri().toURL();
4949
} catch (IOException e) {
5050
throw new IOError(e);
@@ -120,7 +120,7 @@ public Location createLocation(Location parent, URL defaultValue, boolean readon
120120
@Override
121121
public URL getDataArea(String path) throws IOException {
122122
try {
123-
Path locationPath = Paths.get(location.toURI());
123+
var locationPath = Paths.get(location.toURI());
124124
return locationPath.resolve(path).toUri().toURL();
125125
} catch (URISyntaxException e) {
126126
throw new IOException("Location not correctly formatted.", e);
@@ -130,7 +130,7 @@ public URL getDataArea(String path) throws IOException {
130130
@Override
131131
public void close() throws Exception {
132132
try {
133-
Path path = Path.of(location.toURI());
133+
var path = Path.of(location.toURI());
134134
Files.walk(path)
135135
.sorted(Comparator.reverseOrder())
136136
.map(Path::toFile)

_ext/eclipse-base/src/test/java/com/diffplug/spotless/extra/eclipse/base/SpotlessEclipseFrameworkTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public void println(String x) {
251251
@Override
252252
public void println(Object x) {
253253
if (x instanceof Exception) {
254-
Exception e = (Exception) x;
254+
var e = (Exception) x;
255255
if (TEST_EXCEPTION_MESSAGE == e.getMessage()) {
256256
messages.add(TEST_EXCEPTION_MESSAGE);
257257
}

_ext/eclipse-base/src/test/java/com/diffplug/spotless/extra/eclipse/base/osgi/BundleSetTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void testAddGet() throws BundleException {
4949

5050
@Test
5151
void testSameSymbolicName() throws BundleException {
52-
final String symbolicName = "sym.a";
52+
final var symbolicName = "sym.a";
5353
final long id1 = 12345;
5454
final long id2 = 23456;
5555
Bundle testBundle1 = new TestBundle(id1, symbolicName);
@@ -63,8 +63,8 @@ void testSameSymbolicName() throws BundleException {
6363

6464
@Test
6565
void testSameID() throws BundleException {
66-
final String symbolicName1 = "sym.a";
67-
final String symbolicName2 = "sym.b";
66+
final var symbolicName1 = "sym.a";
67+
final var symbolicName2 = "sym.b";
6868
final long id = 12345;
6969
Bundle testBundle1 = new TestBundle(id, symbolicName1);
7070
Bundle testBundle2 = new TestBundle(id, symbolicName2);

_ext/eclipse-base/src/test/java/com/diffplug/spotless/extra/eclipse/base/osgi/ServiceCollectionTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ void initialize() {
3939

4040
@Test
4141
void testAddGet() {
42-
Service1 service1 = new Service1();
43-
Service2 service2 = new Service2();
42+
var service1 = new Service1();
43+
var service2 = new Service2();
4444
instance.add(Interf1.class, service1);
4545
instance.add(Interf2a.class, service2);
4646
instance.add(Interf2b.class, service2);
@@ -51,8 +51,8 @@ void testAddGet() {
5151

5252
@Test
5353
void testMultipleServicesPerInterface() {
54-
Service1 serviceX = new Service1();
55-
Service1 serviceY = new Service1();
54+
var serviceX = new Service1();
55+
var serviceY = new Service1();
5656
instance.add(Interf1.class, serviceX);
5757
ServiceException e = assertThrows(ServiceException.class, () -> instance.add(Interf1.class, serviceY));
5858
assertThat(e.getMessage()).as("ServiceException does not contain interface class name.").contains(Interf1.class.getName());

_ext/eclipse-wtp/src/main/java/com/diffplug/spotless/extra/eclipse/wtp/EclipseHtmlFormatterStepImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public void activatePlugins(SpotlessEclipsePluginConfig config) {
141141
* The HTML formatter only uses the DOCTYPE/SCHEMA for content model selection.
142142
* Hence no external URIs are required.
143143
*/
144-
boolean allowExternalURI = false;
144+
var allowExternalURI = false;
145145
EclipseXmlFormatterStepImpl.FrameworkConfig.activateXmlPlugins(config, allowExternalURI);
146146
config.add(new HTMLCorePlugin());
147147
}

0 commit comments

Comments
 (0)