Skip to content

Commit

Permalink
compiler.batch: for each - manual cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
EcljpseB0T committed Mar 5, 2024
1 parent 2a78d2f commit 819f251
Show file tree
Hide file tree
Showing 62 changed files with 322 additions and 353 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,8 @@ protected Commandline setupJavacCommand() throws BuildException {
*/
if (this.attributes.getNowarn()) {
// disable all warnings
Object[] entries = this.customDefaultOptions.entrySet().toArray();
for (Object entry2 : entries) {
Map.Entry entry = (Map.Entry) entry2;
for (Object o : this.customDefaultOptions.entrySet()) {
Map.Entry entry = (Map.Entry) o;
if (!(entry.getKey() instanceof String))
continue;
if (!(entry.getValue() instanceof String))
Expand Down Expand Up @@ -550,8 +549,8 @@ public int compare(Object o1, Object o2) {
Arrays.sort(encodedDirs, comparator);
}

for (File element : this.compileList) {
String arg = element.getAbsolutePath();
for (File file : this.compileList) {
String arg = file.getAbsolutePath();
boolean encoded = false;
if (encodedFiles != null) {
//check for file level custom encoding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1984,8 +1984,8 @@ public static final boolean contains(char[] characters, char[] array) {
* @since 3.14
*/
public static boolean containsEqual(char[][] array, char[] sequence) {
for (char[] element : array) {
if (equals(element, sequence))
for (char[] c : array) {
if (equals(c, sequence))
return true;
}
return false;
Expand Down Expand Up @@ -3354,8 +3354,8 @@ public static final boolean pathMatch(
*/
public static final int occurencesOf(char toBeFound, char[] array) {
int count = 0;
for (char element : array)
if (toBeFound == element)
for (char c : array)
if (toBeFound == c)
count++;
return count;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ else if (this.referenceBinding.isAnnotationType())
this.missingTypes = superclass.collectMissingTypes(this.missingTypes);
}
ReferenceBinding[] superInterfaces = this.referenceBinding.superInterfaces();
for (ReferenceBinding element : superInterfaces) {
this.missingTypes = element.collectMissingTypes(this.missingTypes);
for (ReferenceBinding superInterface : superInterfaces) {
this.missingTypes = superInterface.collectMissingTypes(this.missingTypes);
}
attributesNumber += generateHierarchyInconsistentAttribute();
}
Expand Down Expand Up @@ -3747,8 +3747,8 @@ private int addBootStrapLambdaEntry(int localContentsOffset, FunctionalExpressio
int markerInterfaceCountIndex = this.constantPool.literalIndex(markerInterfaces.length);
this.contents[localContentsOffset++] = (byte)(markerInterfaceCountIndex>>8);
this.contents[localContentsOffset++] = (byte)(markerInterfaceCountIndex);
for (TypeBinding element : markerInterfaces) {
int classTypeIndex = this.constantPool.literalIndexForType(element);
for (TypeBinding markerInterface : markerInterfaces) {
int classTypeIndex = this.constantPool.literalIndexForType(markerInterface);
this.contents[localContentsOffset++] = (byte)(classTypeIndex>>8);
this.contents[localContentsOffset++] = (byte)(classTypeIndex);
}
Expand Down Expand Up @@ -4863,9 +4863,9 @@ private int generateRuntimeAnnotationsForParameters(Argument[] arguments) {
Argument argument = arguments[i];
Annotation[] annotations = argument.annotations;
if (annotations != null) {
for (Annotation annotation2 : annotations) {
for (Annotation a : annotations) {
Annotation annotation;
if ((annotation = annotation2.getPersistibleAnnotation()) == null) continue; // already packaged into container.
if ((annotation = a.getPersistibleAnnotation()) == null) continue; // already packaged into container.
long annotationMask = annotation.resolvedType != null ? annotation.resolvedType.getAnnotationTagBits() & TagBits.AnnotationTargetMASK : 0;
if (annotationMask != 0 && (annotationMask & TagBits.AnnotationForParameter) == 0) continue;
if (annotation.isRuntimeInvisible()) {
Expand Down Expand Up @@ -4909,9 +4909,9 @@ private int generateRuntimeAnnotationsForParameters(Argument[] arguments) {
if (numberOfInvisibleAnnotations != 0) {
Argument argument = arguments[i];
Annotation[] annotations = argument.annotations;
for (Annotation annotation2 : annotations) {
for (Annotation a : annotations) {
Annotation annotation;
if ((annotation = annotation2.getPersistibleAnnotation()) == null) continue; // already packaged into container.
if ((annotation = a.getPersistibleAnnotation()) == null) continue; // already packaged into container.
long annotationMask = annotation.resolvedType != null ? annotation.resolvedType.getAnnotationTagBits() & TagBits.AnnotationTargetMASK : 0;
if (annotationMask != 0 && (annotationMask & TagBits.AnnotationForParameter) == 0) continue;
if (annotation.isRuntimeInvisible()) {
Expand Down Expand Up @@ -4970,9 +4970,9 @@ private int generateRuntimeAnnotationsForParameters(Argument[] arguments) {
if (numberOfVisibleAnnotations != 0) {
Argument argument = arguments[i];
Annotation[] annotations = argument.annotations;
for (Annotation annotation2 : annotations) {
for (Annotation a : annotations) {
Annotation annotation;
if ((annotation = annotation2.getPersistibleAnnotation()) == null) continue; // already packaged into container.
if ((annotation = a.getPersistibleAnnotation()) == null) continue; // already packaged into container.
long annotationMask = annotation.resolvedType != null ? annotation.resolvedType.getAnnotationTagBits() & TagBits.AnnotationTargetMASK : 0;
if (annotationMask != 0 && (annotationMask & TagBits.AnnotationForParameter) == 0) continue;
if (annotation.isRuntimeVisible()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ private void addAnnotatedElements(ReferenceBinding anno, ReferenceBinding type,
result.add(this._factory.newElement(type));
}
}
for (ReferenceBinding element : type.memberTypes()) {
addAnnotatedElements(anno, element, result);
for (ReferenceBinding binding : type.memberTypes()) {
addAnnotatedElements(anno, binding, result);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ public String toString() {
.append("search location for ") //$NON-NLS-1$
.append(this.searchedAnnotation)
.append("\ncurrent type_path entries : "); //$NON-NLS-1$
for (Object element : this.typePathEntries) {
int[] typePathEntry = (int[]) element;
for (Object entry : this.typePathEntries) {
int[] typePathEntry = (int[]) entry;
buffer
.append('(')
.append(typePathEntry[0])
Expand Down Expand Up @@ -838,18 +838,18 @@ public void recordSuppressWarnings(Scope scope, int startSuppresss, int endSuppr
ArrayInitializer initializer = (ArrayInitializer) value;
Expression[] inits = initializer.expressions;
if (inits != null) {
for (Expression init2 : inits) {
Constant cst = init2.constant;
for (Expression init : inits) {
Constant cst = init.constant;
if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
IrritantSet irritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
if (irritants != null) {
if (suppressWarningIrritants == null) {
suppressWarningIrritants = new IrritantSet(irritants);
} else if (suppressWarningIrritants.set(irritants) == null) {
scope.problemReporter().unusedWarningToken(init2);
scope.problemReporter().unusedWarningToken(init);
}
} else {
scope.problemReporter().unhandledWarningToken(init2);
scope.problemReporter().unhandledWarningToken(init);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ public void traverse(ASTVisitor visitor, BlockScope scope) {
}
}
if (this.annotationsOnDimensions != null) {
for (Annotation[] annotations2 : this.annotationsOnDimensions) {
for (int j = 0, max2 = annotations2 == null ? 0 : annotations2.length; j < max2; j++) {
Annotation annotation = annotations2[j];
for (Annotation[] annotationsOnDimension : this.annotationsOnDimensions) {
for (int j = 0, max2 = annotationsOnDimension == null ? 0 : annotationsOnDimension.length; j < max2; j++) {
Annotation annotation = annotationsOnDimension[j];
annotation.traverse(visitor, scope);
}
}
Expand All @@ -194,9 +194,9 @@ public void traverse(ASTVisitor visitor, ClassScope scope) {
}
}
if (this.annotationsOnDimensions != null) {
for (Annotation[] annotations2 : this.annotationsOnDimensions) {
for (int j = 0, max2 = annotations2 == null ? 0 : annotations2.length; j < max2; j++) {
Annotation annotation = annotations2[j];
for (Annotation[] annotationsOnDimension : this.annotationsOnDimensions) {
for (int j = 0, max2 = annotationsOnDimension == null ? 0 : annotationsOnDimension.length; j < max2; j++) {
Annotation annotation = annotationsOnDimension[j];
annotation.traverse(visitor, scope);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ public void traverse(ASTVisitor visitor, BlockScope scope) {
}
}
if (this.annotationsOnDimensions != null) {
for (Annotation[] annotations2 : this.annotationsOnDimensions) {
if (annotations2 != null) {
for (Annotation annotation : annotations2) {
for (Annotation[] annotationsOnDimension : this.annotationsOnDimensions) {
if (annotationsOnDimension != null) {
for (Annotation annotation : annotationsOnDimension) {
annotation.traverse(visitor, scope);
}
}
Expand All @@ -189,9 +189,9 @@ public void traverse(ASTVisitor visitor, ClassScope scope) {
}
}
if (this.annotationsOnDimensions != null) {
for (Annotation[] annotations2 : this.annotationsOnDimensions) {
if (annotations2 != null) {
for (Annotation annotation : annotations2) {
for (Annotation[] annotationsOnDimension : this.annotationsOnDimensions) {
if (annotationsOnDimension != null) {
for (Annotation annotation : annotationsOnDimension) {
annotation.traverse(visitor, scope);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
}
int pc = codeStream.position;
if (this.targetLabels != null) {
for (BranchLabel targetLabel2 : this.targetLabels) {
targetLabel2.place();
for (BranchLabel label : this.targetLabels) {
label.place();
}
}
if (this.targetLabel != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ public void analyseCode() {
return;
try {
if (this.types != null) {
for (TypeDeclaration type2 : this.types) {
type2.analyseCode(this.scope);
for (TypeDeclaration t : this.types) {
t.analyseCode(this.scope);
}
}
if (this.moduleDeclaration != null) {
Expand All @@ -154,8 +154,8 @@ public void analyseCode() {
*/
public void cleanUp() {
if (this.types != null) {
for (TypeDeclaration type2 : this.types) {
cleanUp(type2);
for (TypeDeclaration t : this.types) {
cleanUp(t);
}
for (LocalTypeBinding localType : this.localTypes.values()) {
// null out the type's scope backpointers
Expand All @@ -172,9 +172,8 @@ public void cleanUp() {
this.compilationResult.recoveryScannerData = null; // recovery is already done

ClassFile[] classFiles = this.compilationResult.getClassFiles();
for (ClassFile classFile2 : classFiles) {
for (ClassFile classFile : classFiles) {
// clear the classFile back pointer to the bindings
ClassFile classFile = classFile2;
// null out the classfile backpointer to a type binding
classFile.referenceBinding = null;
classFile.innerClassesBindings = null;
Expand Down Expand Up @@ -234,8 +233,8 @@ public void createPackageInfoType() {
* e.g. if we're looking for X.A.B then a type name would be {X, A, B}
*/
public TypeDeclaration declarationOfType(char[][] typeName) {
for (TypeDeclaration type2 : this.types) {
TypeDeclaration typeDecl = type2.declarationOfType(typeName);
for (TypeDeclaration t : this.types) {
TypeDeclaration typeDecl = t.declarationOfType(typeName);
if (typeDecl != null) {
return typeDecl;
}
Expand Down Expand Up @@ -409,8 +408,8 @@ public void generateCode() {
}
try {
if (this.types != null) {
for (TypeDeclaration type2 : this.types)
type2.generateCode(this.scope);
for (TypeDeclaration t : this.types)
t.generateCode(this.scope);
}
if (this.moduleDeclaration != null) {
this.moduleDeclaration.generateCode();
Expand Down Expand Up @@ -503,8 +502,8 @@ public StringBuilder print(int indent, StringBuilder output) {
if (this.moduleDeclaration != null) {
this.moduleDeclaration.print(indent, output).append("\n"); //$NON-NLS-1$
} else if (this.types != null) {
for (TypeDeclaration type2 : this.types) {
type2.print(indent, output).append("\n"); //$NON-NLS-1$
for (TypeDeclaration t : this.types) {
t.print(indent, output).append("\n"); //$NON-NLS-1$
}
}
return output;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ public void analyseCode(ClassScope classScope, InitializationFlowContext initial
// set since they are supposed to be set inside other local constructor
if (this.constructorCall.accessMode == ExplicitConstructorCall.This) {
FieldBinding[] fields = this.binding.declaringClass.fields();
for (FieldBinding field2 : fields) {
FieldBinding field;
if (!(field = field2).isStatic()) {
for (FieldBinding field : fields) {
if (!field.isStatic()) {
flowInfo.markAsDefinitelyAssigned(field);
}
}
Expand Down Expand Up @@ -349,9 +348,8 @@ public void generateSyntheticFieldInitializationsIfNecessary(MethodScope methodS

SyntheticArgumentBinding[] syntheticArgs = nestedType.syntheticEnclosingInstances();
if (syntheticArgs != null) {
for (SyntheticArgumentBinding syntheticArg2 : syntheticArgs) {
SyntheticArgumentBinding syntheticArg;
if ((syntheticArg = syntheticArg2).matchingField != null) {
for (SyntheticArgumentBinding syntheticArg : syntheticArgs) {
if (syntheticArg.matchingField != null) {
codeStream.aload_0();
codeStream.load(syntheticArg);
codeStream.fieldAccess(Opcodes.OPC_putfield, syntheticArg.matchingField, null /* default declaringClass */);
Expand All @@ -360,9 +358,8 @@ public void generateSyntheticFieldInitializationsIfNecessary(MethodScope methodS
}
syntheticArgs = nestedType.syntheticOuterLocalVariables();
if (syntheticArgs != null) {
for (SyntheticArgumentBinding syntheticArg2 : syntheticArgs) {
SyntheticArgumentBinding syntheticArg;
if ((syntheticArg = syntheticArg2).matchingField != null) {
for (SyntheticArgumentBinding syntheticArg : syntheticArgs) {
if (syntheticArg.matchingField != null) {
codeStream.aload_0();
codeStream.load(syntheticArg);
codeStream.fieldAccess(Opcodes.OPC_putfield, syntheticArg.matchingField, null /* default declaringClass */);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -956,8 +956,8 @@ private void getAllInheritedMethods0(ReferenceBinding binding, ArrayList<MethodB
collector.add(methodBinding);
}
ReferenceBinding[] superInterfaces = binding.superInterfaces();
for (ReferenceBinding element : superInterfaces) {
getAllInheritedMethods0(element, collector);
for (ReferenceBinding superInterface : superInterfaces) {
getAllInheritedMethods0(superInterface, collector);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ public void resolve(MethodScope initializationScope) {
resolveAnnotations(initializationScope, this.annotations, this.binding);
// Check if this declaration should now have the type annotations bit set
if (this.annotations != null) {
for (Annotation annotation2 : this.annotations) {
TypeBinding resolvedAnnotationType = annotation2.resolvedType;
for (Annotation annotation : this.annotations) {
TypeBinding resolvedAnnotationType = annotation.resolvedType;
if (resolvedAnnotationType != null && (resolvedAnnotationType.getAnnotationTagBits() & TagBits.AnnotationForTypeUse) != 0) {
this.bits |= ASTNode.HasTypeAnnotations;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public IntersectionCastTypeReference(TypeReference[] typeReferences) {
this.sourceStart = typeReferences[0].sourceStart;
int length = typeReferences.length;
this.sourceEnd = typeReferences[length - 1].sourceEnd;
for (TypeReference element : typeReferences) {
if ((element.bits & ASTNode.HasTypeAnnotations) != 0) {
for (TypeReference reference : typeReferences) {
if ((reference.bits & ASTNode.HasTypeAnnotations) != 0) {
this.bits |= ASTNode.HasTypeAnnotations;
break;
}
Expand Down

0 comments on commit 819f251

Please sign in to comment.