Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2021-03-24 14:25:45 +0000
committerLars Vogel2021-03-25 07:50:47 +0000
commit49b3c42b94f4d1f7926d1505b06121e336fdcf14 (patch)
tree4da4a7f96afb40a059b734e93219cad0e78e508a
parentbb1add974ff4c8f1105b570de75224acbd393179 (diff)
downloadrt.equinox.p2-49b3c42b94f4d1f7926d1505b06121e336fdcf14.tar.gz
rt.equinox.p2-49b3c42b94f4d1f7926d1505b06121e336fdcf14.tar.xz
rt.equinox.p2-49b3c42b94f4d1f7926d1505b06121e336fdcf14.zip
Use JDT clean up "Convert field into local variable if field is used
only local" No need to save the value as field if it is only used locally. Change-Id: Iedcab54309243a4dcd944c6b6302450b094bfd3c Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/ClassFileReader.java13
2 files changed, 7 insertions, 9 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java
index 1d3cc1e80..42672c6e9 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java
@@ -28,7 +28,6 @@ public class OptimizationFunction {
private IQueryable<IInstallableUnit> picker;
private IInstallableUnit selectionContext;
protected Map<String, Map<Version, IInstallableUnit>> slice; //The IUs that have been considered to be part of the problem
- private int numberOfInstalledIUs; //TODO this should be renamed to consideredIUs or sliceSize
private IQueryable<IInstallableUnit> lastState;
private List<AbstractVariable> optionalRequirementVariable;
@@ -42,7 +41,7 @@ public class OptimizationFunction {
//Create an optimization function favoring the highest version of each IU
public List<WeightedObject<? extends Object>> createOptimizationFunction(IInstallableUnit metaIu, Collection<IInstallableUnit> newRoots) {
- numberOfInstalledIUs = sizeOf(lastState);
+ int numberOfInstalledIUs = sizeOf(lastState);
List<WeightedObject<? extends Object>> weightedObjects = new ArrayList<>();
Set<IInstallableUnit> transitiveClosure; //The transitive closure of the IUs we are adding (this also means updating)
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/ClassFileReader.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/ClassFileReader.java
index 6ad7ce7e7..1616ea649 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/ClassFileReader.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/ClassFileReader.java
@@ -77,7 +77,6 @@ public class ClassFileReader extends ClassFileStruct {
private InnerClassesAttribute innerClassesAttribute;
private int[] interfaceIndexes;
private char[][] interfaceNames;
- private int interfacesCount;
private int magicNumber;
private int majorVersion;
private MethodInfo[] methods;
@@ -199,21 +198,21 @@ public class ClassFileReader extends ClassFileStruct {
}
// Read the interfaces, use exception handlers to catch bad format
- this.interfacesCount = u2At(classFileBytes, readOffset, 0);
+ int interfacesCount = u2At(classFileBytes, readOffset, 0);
readOffset += 2;
this.interfaceNames = NO_INTERFACES_NAMES;
this.interfaceIndexes = Utility.EMPTY_INT_ARRAY;
- if (this.interfacesCount != 0) {
+ if (interfacesCount != 0) {
if ((decodingFlags & SUPER_INTERFACES) != CONSTANT_POOL) {
- this.interfaceNames = new char[this.interfacesCount][];
- this.interfaceIndexes = new int[this.interfacesCount];
- for (int i = 0; i < this.interfacesCount; i++) {
+ this.interfaceNames = new char[interfacesCount][];
+ this.interfaceIndexes = new int[interfacesCount];
+ for (int i = 0; i < interfacesCount; i++) {
this.interfaceIndexes[i] = u2At(classFileBytes, readOffset, 0);
this.interfaceNames[i] = getConstantClassNameAt(classFileBytes, constantPoolOffsets, this.interfaceIndexes[i]);
readOffset += 2;
}
} else {
- readOffset += (2 * this.interfacesCount);
+ readOffset += (2 * interfacesCount);
}
}
// Read the this.fields, use exception handlers to catch bad format

Back to the top