Skip to content

Commit 2d2a0e4

Browse files
eclipse-equinox-botlaeubi
authored andcommitted
Perform clean code of bundles/org.eclipse.equinox.p2.publisher.eclipse
1 parent 8bc9e27 commit 2d2a0e4

File tree

9 files changed

+10
-22
lines changed

9 files changed

+10
-22
lines changed

bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/bundledescription/BundleDescriptionImpl.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,9 @@ public Object getKey() {
429429

430430
@Override
431431
public boolean compare(KeyedElement other) {
432-
if (!(other instanceof BundleDescriptionImpl)) {
432+
if (!(other instanceof BundleDescriptionImpl otherBundleDescription)) {
433433
return false;
434434
}
435-
BundleDescriptionImpl otherBundleDescription = (BundleDescriptionImpl) other;
436435
return bundleId == otherBundleDescription.bundleId;
437436
}
438437

@@ -733,10 +732,9 @@ public int hashCode() {
733732

734733
@Override
735734
public boolean equals(Object obj) {
736-
if (!(obj instanceof BundleWireImpl)) {
735+
if (!(obj instanceof BundleWireImpl other)) {
737736
return false;
738737
}
739-
BundleWireImpl other = (BundleWireImpl) obj;
740738
return capability.equals(other.getCapability()) && requirement.equals(other.getRequirement()) && provider.equals(other.getProviderWiring()) && requirer.equals(other.getRequirerWiring());
741739
}
742740

bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/bundledescription/BundleSpecificationImpl.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,9 @@ void setArbitraryDirectives(Map<String, ?> directives) {
7373

7474
@Override
7575
public boolean isSatisfiedBy(BaseDescription supplier) {
76-
if (!(supplier instanceof BundleDescriptionImpl)) {
76+
if (!(supplier instanceof BundleDescriptionImpl candidate)) {
7777
return false;
7878
}
79-
BundleDescriptionImpl candidate = (BundleDescriptionImpl) supplier;
8079
if (candidate.getHost() != null) {
8180
return false;
8281
}

bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/bundledescription/GenericSpecificationImpl.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ void setMatchingFilter(Filter matchingFilter) {
5757

5858
@Override
5959
public boolean isSatisfiedBy(BaseDescription supplier) {
60-
if (!(supplier instanceof GenericDescription)) {
60+
if (!(supplier instanceof GenericDescription candidate)) {
6161
return false;
6262
}
63-
GenericDescription candidate = (GenericDescription) supplier;
6463
if (!getType().equals(candidate.getType())) {
6564
return false;
6665
}

bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/bundledescription/HostSpecificationImpl.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ void setArbitraryDirectives(Map<String, ?> directives) {
4949

5050
@Override
5151
public boolean isSatisfiedBy(BaseDescription supplier) {
52-
if (!(supplier instanceof BundleDescriptionImpl)) {
52+
if (!(supplier instanceof BundleDescriptionImpl candidate)) {
5353
return false;
5454
}
55-
BundleDescriptionImpl candidate = (BundleDescriptionImpl) supplier;
5655
if (candidate.getHost() != null) {
5756
return false;
5857
}

bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/bundledescription/VersionConstraintImpl.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@ static StringBuilder addFilterAttribute(StringBuilder filter, String attr, Objec
206206
}
207207

208208
static StringBuilder addFilterAttribute(StringBuilder filter, String attr, Object value, boolean escapeWildCard) {
209-
if (value instanceof VersionRange) {
210-
VersionRange range = (VersionRange) value;
209+
if (value instanceof VersionRange range) {
211210
filter.append(range.toFilterString(attr));
212211
} else {
213212
filter.append('(').append(attr).append('=').append(escapeValue(value, escapeWildCard)).append(')');

bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,7 @@ private Object convertAttribute(Object attr) {
537537
}
538538

539539
private Object convertScalarAttribute(Object attr) {
540-
if (attr instanceof org.osgi.framework.Version) {
541-
org.osgi.framework.Version osgiVer = (org.osgi.framework.Version) attr;
540+
if (attr instanceof org.osgi.framework.Version osgiVer) {
542541
return Version.createOSGi(osgiVer.getMajor(), osgiVer.getMinor(), osgiVer.getMicro(),
543542
osgiVer.getQualifier());
544543
}

bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EclipsePublisherHelper.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ public static IInstallableUnit[] createEclipseIU(BundleDescription bd, boolean i
4040
}
4141

4242
private static void addExtraProperties(IInstallableUnit iiu, Map<String, String> extraProperties) {
43-
if (iiu instanceof InstallableUnit) {
44-
InstallableUnit iu = (InstallableUnit) iiu;
45-
43+
if (iiu instanceof InstallableUnit iu) {
4644
for (Entry<String, String> entry : extraProperties.entrySet()) {
4745
iu.setProperty(entry.getKey(), entry.getValue());
4846
}

bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1022,10 +1022,9 @@ public boolean equals(Object object) {
10221022
if (object == this) {
10231023
return true;
10241024
}
1025-
if (!(object instanceof RGB)) {
1025+
if (!(object instanceof RGB rgb)) {
10261026
return false;
10271027
}
1028-
RGB rgb = (RGB) object;
10291028
return (rgb.red == this.red) && (rgb.green == this.green) && (rgb.blue == this.blue);
10301029
}
10311030

bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ public void execute() throws BuildException {
5656
private File[] getLocations(List<Object> collection) {
5757
ArrayList<Object> results = new ArrayList<>();
5858
for (Object obj : collection) {
59-
if (obj instanceof FileSet) {
60-
FileSet set = (FileSet) obj;
61-
59+
if (obj instanceof FileSet set) {
6260
DirectoryScanner scanner = set.getDirectoryScanner(getProject());
6361
String[][] elements = new String[][] {scanner.getIncludedDirectories(), scanner.getIncludedFiles()};
6462
for (int i = 0; i < 2; i++) {

0 commit comments

Comments
 (0)