Skip to content

Commit 52a17fb

Browse files
eclipse-pde-botlaeubi
authored andcommitted
Perform clean code of build/org.eclipse.pde.build
1 parent 1dce51d commit 52a17fb

File tree

7 files changed

+9
-18
lines changed

7 files changed

+9
-18
lines changed

build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/Config.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ public boolean equals(Object config) {
5454
return true;
5555
}
5656

57-
if (!(config instanceof Config)) {
57+
if (!(config instanceof Config aConfig)) {
5858
return false;
5959
}
6060

61-
Config aConfig = (Config) config;
6261
if (!os.equalsIgnoreCase(aConfig.os)) {
6362
return false;
6463
}

build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/FeatureGenerator.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ public Entry(String id, String version) {
6969

7070
@Override
7171
public boolean equals(Object obj) {
72-
if (obj instanceof Entry) {
73-
Entry objEntry = (Entry) obj;
72+
if (obj instanceof Entry objEntry) {
7473
if (!(id.equals(((Entry) obj).id) && version.equals(objEntry.version))) {
7574
return false;
7675
}

build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/FetchScriptGenerator.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,7 @@ public MapFileEntry(String id, Version v) {
729729

730730
@Override
731731
public int compareTo(Object o) {
732-
if (o instanceof MapFileEntry) {
733-
MapFileEntry entry = (MapFileEntry) o;
732+
if (o instanceof MapFileEntry entry) {
734733
int result = id.compareTo(entry.id);
735734
if (result != 0) {
736735
return result;
@@ -742,8 +741,7 @@ public int compareTo(Object o) {
742741

743742
@Override
744743
public boolean equals(Object o) {
745-
if (o instanceof MapFileEntry) {
746-
MapFileEntry entry = (MapFileEntry) o;
744+
if (o instanceof MapFileEntry entry) {
747745
return id.equals(entry.id) && v.equals(entry.v);
748746
}
749747
return false;

build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/builder/ClasspathComputer3_0.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ public void addRules(String newRule) {
123123
*/
124124
@Override
125125
public boolean equals(Object obj) {
126-
if (obj instanceof ClasspathElement) {
127-
ClasspathElement element = (ClasspathElement) obj;
126+
if (obj instanceof ClasspathElement element) {
128127
if (!path.equals(element.getPath())) {
129128
return false;
130129
}

build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/ProfileManager.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ private InputStream getProfileListInputStream(Object container) {
184184
return null;
185185
}
186186
}
187-
} else if (container instanceof ZipFile) {
188-
ZipFile zipFile = (ZipFile) container;
187+
} else if (container instanceof ZipFile zipFile) {
189188
ZipEntry listEntry = ((ZipFile) container).getEntry(PROFILE_LIST);
190189
if (listEntry != null) {
191190
try {
@@ -194,8 +193,7 @@ private InputStream getProfileListInputStream(Object container) {
194193
return null;
195194
}
196195
}
197-
} else if (container instanceof Bundle) {
198-
Bundle systemBundle = (Bundle) container;
196+
} else if (container instanceof Bundle systemBundle) {
199197
URL url = systemBundle.getEntry(PROFILE_LIST);
200198
if (url != null) {
201199
try {

build/org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/tasks/Config.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,10 @@ public boolean equals(Object config) {
5050
return true;
5151
}
5252

53-
if (!(config instanceof Config)) {
53+
if (!(config instanceof Config aConfig)) {
5454
return false;
5555
}
5656

57-
Config aConfig = (Config) config;
5857
if (!os.equalsIgnoreCase(aConfig.os)) {
5958
return false;
6059
}

build/org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/tasks/Version.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,10 @@ public boolean equals(Object object) {
291291
return true;
292292
}
293293

294-
if (!(object instanceof Version)) {
294+
if (!(object instanceof Version other)) {
295295
return false;
296296
}
297297

298-
Version other = (Version) object;
299298
return (major == other.major) && (minor == other.minor) && (micro == other.micro) && qualifier.equals(other.qualifier);
300299
}
301300

0 commit comments

Comments
 (0)