From 44d06e374e771a701df2b5882bd6bc35ce9d278f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Tue, 5 Mar 2024 17:29:11 +0100 Subject: [PATCH] compiler.batch: for each - manual cleanup --- .../eclipse/jdt/core/JDTCompilerAdapter.java | 9 +- .../jdt/core/compiler/CharOperation.java | 8 +- .../jdt/internal/compiler/ClassFile.java | 20 ++-- .../compiler/apt/dispatch/RoundEnvImpl.java | 4 +- .../jdt/internal/compiler/ast/Annotation.java | 12 +-- .../ast/ArrayQualifiedTypeReference.java | 12 +-- .../compiler/ast/ArrayTypeReference.java | 12 +-- .../internal/compiler/ast/CaseStatement.java | 4 +- .../ast/CompilationUnitDeclaration.java | 23 +++-- .../compiler/ast/ConstructorDeclaration.java | 15 ++- .../jdt/internal/compiler/ast/Expression.java | 4 +- .../compiler/ast/FieldDeclaration.java | 4 +- .../ast/IntersectionCastTypeReference.java | 4 +- .../jdt/internal/compiler/ast/Javadoc.java | 36 ++++---- .../compiler/ast/NullAnnotationMatching.java | 6 +- .../compiler/ast/OperatorExpression.java | 43 +++++---- .../ParameterizedQualifiedTypeReference.java | 20 ++-- .../ast/ParameterizedSingleTypeReference.java | 10 +- .../compiler/ast/QualifiedTypeReference.java | 4 +- .../compiler/ast/RecordComponent.java | 4 +- .../internal/compiler/ast/StringTemplate.java | 4 +- .../compiler/ast/TypeDeclaration.java | 17 ++-- .../internal/compiler/ast/TypeReference.java | 8 +- .../internal/compiler/batch/BasicModule.java | 8 +- .../jdt/internal/compiler/batch/Main.java | 11 +-- .../compiler/classfmt/ClassFileReader.java | 4 +- .../compiler/classfmt/MethodInfo.java | 4 +- .../compiler/classfmt/ModuleInfo.java | 4 +- .../compiler/classfmt/TypeAnnotationInfo.java | 4 +- .../compiler/codegen/BranchLabel.java | 3 +- .../codegen/StackMapFrameCodeStream.java | 20 +--- .../compiler/flow/LoopingFlowContext.java | 4 +- .../compiler/lookup/BinaryModuleBinding.java | 6 +- .../compiler/lookup/BinaryTypeBinding.java | 22 ++--- .../internal/compiler/lookup/BlockScope.java | 4 +- .../internal/compiler/lookup/BoundSet.java | 91 +++++++++---------- .../internal/compiler/lookup/ClassScope.java | 6 +- .../compiler/lookup/CompilationUnitScope.java | 4 +- .../lookup/ConstraintExceptionFormula.java | 10 +- .../compiler/lookup/InferenceContext.java | 6 +- .../compiler/lookup/InferenceContext18.java | 4 +- .../compiler/lookup/LookupEnvironment.java | 14 +-- .../compiler/lookup/MethodBinding.java | 4 +- .../compiler/lookup/MethodVerifier.java | 8 +- .../compiler/lookup/ModuleBinding.java | 12 +-- .../ParameterizedGenericMethodBinding.java | 4 +- .../lookup/ParameterizedTypeBinding.java | 11 +-- .../compiler/lookup/ReferenceBinding.java | 16 ++-- .../jdt/internal/compiler/lookup/Scope.java | 16 ++-- .../compiler/lookup/SourceTypeBinding.java | 12 +-- .../compiler/lookup/TypeVariableBinding.java | 48 +++++----- .../compiler/lookup/WildcardBinding.java | 10 +- .../compiler/parser/JavadocTagConstants.java | 6 +- .../jdt/internal/compiler/parser/Parser.java | 12 +-- .../parser/diagnose/DiagnoseParser.java | 8 +- .../compiler/problem/ProblemReporter.java | 4 +- .../compiler/tool/EclipseCompilerImpl.java | 3 +- .../compiler/util/HashtableOfModule.java | 4 +- .../compiler/util/HashtableOfObjectToInt.java | 6 +- .../util/HashtableOfObjectToIntArray.java | 6 +- .../compiler/util/HashtableOfType.java | 4 +- .../jdt/internal/compiler/util/Sorting.java | 4 +- .../jdt/internal/compiler/util/Util.java | 8 +- 63 files changed, 345 insertions(+), 373 deletions(-) diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/JDTCompilerAdapter.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/JDTCompilerAdapter.java index 9b5e8df38b1..a25db9858e4 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/JDTCompilerAdapter.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/JDTCompilerAdapter.java @@ -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)) @@ -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 diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/compiler/CharOperation.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/compiler/CharOperation.java index 94d5545de75..2f08682850d 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/compiler/CharOperation.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/compiler/CharOperation.java @@ -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; @@ -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; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ClassFile.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ClassFile.java index f60144a0bff..f35d9636627 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ClassFile.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ClassFile.java @@ -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(); } @@ -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); } @@ -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()) { @@ -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()) { @@ -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()) { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java index 7117c2c15b6..be99d72313f 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java @@ -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); } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Annotation.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Annotation.java index 08e33c93b17..ed8e0370a20 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Annotation.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Annotation.java @@ -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]) @@ -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); } } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java index 0438edf931b..94d390a9dd2 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java @@ -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); } } @@ -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); } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java index 16e18c4b673..4a7cae4e7ad 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java @@ -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); } } @@ -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); } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java index 2dbe844dbed..dbed4fb4f54 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java @@ -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) diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java index 7bbe841a865..66459d6e9b7 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java @@ -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) { @@ -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 @@ -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; @@ -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; } @@ -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(); @@ -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; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java index 2fe55d1e52b..5e75b4d53ca 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java @@ -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); } } @@ -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 */); @@ -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 */); diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Expression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Expression.java index 975dc9c82dc..87419ccedc4 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Expression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Expression.java @@ -956,8 +956,8 @@ private void getAllInheritedMethods0(ReferenceBinding binding, ArrayList= s; - // if ( z0 != (((short) 5) >= ((short) 5))) - // System.out.println(155); - - { s += "\t\t"+decode.type(result)+"0"+" = "+decode.type(left); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$ - s += " "+decode.operator(operator)+" "+decode.type(right)+";\n"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-3$ - String begin = result == T_JavaLangString ? "\t\tif (! " : "\t\tif ( "; //$NON-NLS-2$ //$NON-NLS-1$ - String test = result == T_JavaLangString ? ".equals(" : " != ("; //$NON-NLS-2$ //$NON-NLS-1$ - s += begin +decode.type(result)+"0"+test //$NON-NLS-1$ - +decode.constant(left)+" " //$NON-NLS-1$ - +decode.operator(operator)+" " //$NON-NLS-1$ - +decode.constant(right)+"))\n"; //$NON-NLS-1$ - s += "\t\t\tSystem.out.println("+ (++error) +");\n"; //$NON-NLS-1$ //$NON-NLS-2$ + for (int operator : operators) { + for (int left = 0; left < 16; left++) { + for (int right = 0; right < 16; right++) { + int result = (OperatorSignatures[operator][(left << 4) + right]) & 0x0000F; + if (result != T_undefined) + + // 1/ First regular computation then 2/ comparaison + // with a compile time constant (generated by the compiler) + // z0 = s >= s; + // if ( z0 != (((short) 5) >= ((short) 5))) + // System.out.println(155); + + { + s += "\t\t" + decode.type(result) + "0" + " = " + decode.type(left); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$ + s += " " + decode.operator(operator) + " " + decode.type(right) + ";\n"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-3$ + String begin = result == T_JavaLangString ? "\t\tif (! " : "\t\tif ( "; //$NON-NLS-2$ //$NON-NLS-1$ + String test = result == T_JavaLangString ? ".equals(" : " != ("; //$NON-NLS-2$ //$NON-NLS-1$ + s += begin + decode.type(result) + "0" + test //$NON-NLS-1$ + + decode.constant(left) + " " //$NON-NLS-1$ + + decode.operator(operator) + " " //$NON-NLS-1$ + + decode.constant(right) + "))\n"; //$NON-NLS-1$ + s += "\t\t\tSystem.out.println(" + (++error) + ");\n"; //$NON-NLS-1$ //$NON-NLS-2$ } } } + } return s += "\n\t\tSystem.out.println(\"binary tables test : done\");}"; //$NON-NLS-1$ } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java index 3dd2a75bad5..71a4a9d1be5 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java @@ -482,17 +482,17 @@ public void traverse(ASTVisitor visitor, BlockScope scope) { } Annotation [][] annotationsOnDimensions = getAnnotationsOnDimensions(true); if (annotationsOnDimensions != null) { - for (Annotation[] annotations2 : annotationsOnDimensions) { - for (int j = 0, max2 = annotations2 == null ? 0 : annotations2.length; j < max2; j++) { - Annotation annotation = annotations2[j]; + for (Annotation[] annotationsOnDimension : annotationsOnDimensions) { + for (int j = 0, max2 = annotationsOnDimension == null ? 0 : annotationsOnDimension.length; j < max2; j++) { + Annotation annotation = annotationsOnDimension[j]; annotation.traverse(visitor, scope); } } } for (TypeReference[] typeArgument : this.typeArguments) { if (typeArgument != null) { - for (int j = 0, max2 = typeArgument.length; j < max2; j++) { - typeArgument[j].traverse(visitor, scope); + for (TypeReference typeReference : typeArgument) { + typeReference.traverse(visitor, scope); } } } @@ -513,17 +513,17 @@ public void traverse(ASTVisitor visitor, ClassScope scope) { } Annotation [][] annotationsOnDimensions = getAnnotationsOnDimensions(true); if (annotationsOnDimensions != null) { - for (Annotation[] annotations2 : annotationsOnDimensions) { - for (int j = 0, max2 = annotations2 == null ? 0 : annotations2.length; j < max2; j++) { - Annotation annotation = annotations2[j]; + for (Annotation[] annotationsOnDimension : annotationsOnDimensions) { + for (int j = 0, max2 = annotationsOnDimension == null ? 0 : annotationsOnDimension.length; j < max2; j++) { + Annotation annotation = annotationsOnDimension[j]; annotation.traverse(visitor, scope); } } } for (TypeReference[] typeArgument : this.typeArguments) { if (typeArgument != null) { - for (int j = 0, max2 = typeArgument.length; j < max2; j++) { - typeArgument[j].traverse(visitor, scope); + for (TypeReference argument : typeArgument) { + argument.traverse(visitor, scope); } } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java index c0fb623979c..685ab9f07b0 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java @@ -417,9 +417,9 @@ public void traverse(ASTVisitor visitor, BlockScope scope) { } Annotation [][] annotationsOnDimensions = getAnnotationsOnDimensions(true); if (annotationsOnDimensions != null) { - for (Annotation[] annotations2 : annotationsOnDimensions) { - if (annotations2 != null) { - for (Annotation annotation : annotations2) { + for (Annotation[] annotationsOnDimension : annotationsOnDimensions) { + if (annotationsOnDimension != null) { + for (Annotation annotation : annotationsOnDimension) { annotation.traverse(visitor, scope); } } @@ -443,8 +443,8 @@ public void traverse(ASTVisitor visitor, ClassScope scope) { } Annotation [][] annotationsOnDimensions = getAnnotationsOnDimensions(true); if (annotationsOnDimensions != null) { - for (Annotation[] annotations2 : annotationsOnDimensions) { - for (Annotation annotation : annotations2) { + for (Annotation[] annotationsOnDimension : annotationsOnDimensions) { + for (Annotation annotation : annotationsOnDimension) { annotation.traverse(visitor, scope); } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java index 20341f8e2cf..776f7d68919 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java @@ -82,8 +82,8 @@ protected void rejectAnnotationsOnPackageQualifiers(Scope scope, PackageBinding Annotation[] qualifierAnnot = this.annotations[j]; if (qualifierAnnot != null && qualifierAnnot.length > 0) { if (j == 0) { - for (Annotation element : qualifierAnnot) { - scope.problemReporter().typeAnnotationAtQualifiedName(element); + for (Annotation annotation : qualifierAnnot) { + scope.problemReporter().typeAnnotationAtQualifiedName(annotation); } } else { scope.problemReporter().misplacedTypeAnnotations(qualifierAnnot[0], diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java index a1a3d031310..dde93ffb9a2 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java @@ -95,8 +95,8 @@ public void resolve(BlockScope scope) { resolveAnnotations(scope, 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; // also update the accessor's return type: diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/StringTemplate.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/StringTemplate.java index 0b9cfd56bbc..22a70c2be43 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/StringTemplate.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/StringTemplate.java @@ -109,8 +109,8 @@ public StringBuilder printExpression(int indent, StringBuilder output) { output.append("\"\"\n"); //$NON-NLS-1$ for (int i = 0; i < length; i++) { char[] source = this.fragments[i].source(); - for (char element : source) { - Util.appendEscapedChar(output, element, true); + for (char c : source) { + Util.appendEscapedChar(output, c, true); } if (i + 1 < length) { output.append("\\{"); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java index 6ff033d233a..417c389a75a 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java @@ -617,9 +617,8 @@ public AbstractMethodDeclaration declarationOf(MethodBinding methodBinding) { */ public RecordComponent declarationOf(RecordComponentBinding recordComponentBinding) { if (recordComponentBinding != null && this.recordComponents != null) { - for (RecordComponent recordComponent2 : this.recordComponents) { - RecordComponent recordComponent; - if ((recordComponent = recordComponent2).binding == recordComponentBinding) + for (RecordComponent recordComponent : this.recordComponents) { + if (recordComponent.binding == recordComponentBinding) return recordComponent; } } @@ -869,8 +868,7 @@ private void internalAnalyseCode(FlowContext flowContext, FlowInfo flowInfo) { FlowInfo nonStaticFieldInfo = flowInfo.unconditionalFieldLessCopy(); FlowInfo staticFieldInfo = flowInfo.unconditionalFieldLessCopy(); if (this.fields != null) { - for (FieldDeclaration field2 : this.fields) { - FieldDeclaration field = field2; + for (FieldDeclaration field : this.fields) { if (field.isStatic()) { if ((staticFieldInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) field.bits &= ~ASTNode.IsReachable; @@ -938,8 +936,7 @@ private void internalAnalyseCode(FlowContext flowContext, FlowInfo flowInfo) { UnconditionalFlowInfo outerInfo = flowInfo.unconditionalFieldLessCopy(); FlowInfo constructorInfo = nonStaticFieldInfo.unconditionalInits().discardNonFieldInitializations().addInitializationsFrom(outerInfo); SimpleSetOfCharArray jUnitMethodSourceValues = getJUnitMethodSourceValues(); - for (AbstractMethodDeclaration method2 : this.methods) { - AbstractMethodDeclaration method = method2; + for (AbstractMethodDeclaration method : this.methods) { if (method.ignoreFurtherInvestigation) continue; if (method.isInitializationMethod()) { @@ -1492,9 +1489,9 @@ public void resolve() { } else if (enumConstantsWithoutBody != null) { for (final AbstractMethodDeclaration methodDeclaration : this.methods) { if (methodDeclaration.isAbstract() && methodDeclaration.binding != null) { - for (FieldDeclaration element : enumConstantsWithoutBody) - if (element != null) - this.scope.problemReporter().enumConstantMustImplementAbstractMethod(methodDeclaration, element); + for (FieldDeclaration decl : enumConstantsWithoutBody) + if (decl != null) + this.scope.problemReporter().enumConstantMustImplementAbstractMethod(methodDeclaration, decl); } } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeReference.java index d489eddb61c..7463236210f 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeReference.java @@ -449,8 +449,8 @@ public void getAllAnnotationContexts(int targetType, int info, List handleEndorseddirs(ArrayList e for (int i = 0, max = endorsedDirsJars.length; i < max; i++) { File[] current = endorsedDirsJars[i]; if (current != null) { - for (File element : current) { + for (File file : current) { FileSystem.Classpath classpath = FileSystem.getClasspath( - element.getAbsolutePath(), + file.getAbsolutePath(), null, null, this.options, this.releaseVersion); if (classpath != null) { result.add(classpath); @@ -3788,10 +3787,10 @@ protected ArrayList handleExtdirs(ArrayList extdir for (int i = 0, max = extdirsJars.length; i < max; i++) { File[] current = extdirsJars[i]; if (current != null) { - for (File element : current) { + for (File file : current) { FileSystem.Classpath classpath = FileSystem.getClasspath( - element.getAbsolutePath(), + file.getAbsolutePath(), null, null, this.options, this.releaseVersion); if (classpath != null) { result.add(classpath); diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java index aea980bd77d..1f128dda281 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java @@ -1423,8 +1423,8 @@ private void initialize() throws ClassFormatException { this.methods[i].initialize(); } if (this.innerInfos != null) { - for (InnerClassInfo element : this.innerInfos) { - element.initialize(); + for (InnerClassInfo info : this.innerInfos) { + info.initialize(); } } if (this.annotations != null) { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java index c24b04f737e..71b028bbb28 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java @@ -208,8 +208,8 @@ static AnnotationInfo[][] decodeParamAnnotations(int offset, boolean runtimeVisi allParamAnnotations = new AnnotationInfo[numberOfParameters][]; AnnotationInfo[] annos = decodeAnnotations(readOffset, runtimeVisible, numberOfAnnotations, methodInfo); allParamAnnotations[i] = annos; - for (AnnotationInfo element : annos) - readOffset += element.readOffset; + for (AnnotationInfo info : annos) + readOffset += info.readOffset; } } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ModuleInfo.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ModuleInfo.java index 73ceb5de771..c81b7077c91 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ModuleInfo.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ModuleInfo.java @@ -261,8 +261,8 @@ void setAnnotations(AnnotationInfo[] annotationInfos, long tagBits, boolean full this.annotations = annotationInfos; this.tagBits = tagBits; if (fullyInitialize) { - for (AnnotationInfo element : annotationInfos) { - element.initialize(); + for (AnnotationInfo info : annotationInfos) { + info.initialize(); } } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/TypeAnnotationInfo.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/TypeAnnotationInfo.java index b214e3c0ef9..c1c10873734 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/TypeAnnotationInfo.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/TypeAnnotationInfo.java @@ -180,8 +180,8 @@ public int hashCode() { result = prime * result + this.info; result = prime * result + this.info2; if (this.typePath != null) { - for (int element : this.typePath) { - result = prime * result + element; + for (int p : this.typePath) { + result = prime * result + p; } } return result; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java index 9cd1ce43269..d85e4247500 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java @@ -210,8 +210,7 @@ public void place() { // Currently lacking wide support. // end of new code if ((this.codeStream.generateAttributes & (ClassFileConstants.ATTR_VARS | ClassFileConstants.ATTR_STACK_MAP_TABLE | ClassFileConstants.ATTR_STACK_MAP)) != 0) { LocalVariableBinding locals[] = this.codeStream.locals; - for (LocalVariableBinding local2 : locals) { - LocalVariableBinding local = local2; + for (LocalVariableBinding local : locals) { if ((local != null) && (local.initializationCount > 0)) { if (local.initializationPCs[((local.initializationCount - 1) << 1) + 1] == oldPosition) { // we want to prevent interval of size 0 to have a negative size. diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java index 089f6a2c8ef..52629b02ef6 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java @@ -295,16 +295,10 @@ public ExceptionMarker[] getExceptionMarkers() { int size = exceptionMarkerSet.size(); ExceptionMarker[] markers = new ExceptionMarker[size]; int n = 0; - for (Object element : exceptionMarkerSet) { - markers[n++] = (ExceptionMarker) element; + for (Object marker : exceptionMarkerSet) { + markers[n++] = (ExceptionMarker) marker; } Arrays.sort(markers); -// System.out.print('['); -// for (int n = 0; n < size; n++) { -// if (n != 0) System.out.print(','); -// System.out.print(positions[n]); -// } -// System.out.println(']'); return markers; } @@ -313,16 +307,10 @@ public int[] getFramePositions() { int size = set.size(); int[] positions = new int[size]; int n = 0; - for (Object element : set) { - positions[n++] = ((Integer) element).intValue(); + for (Object pos : set) { + positions[n++] = ((Integer) pos).intValue(); } Arrays.sort(positions); -// System.out.print('['); -// for (int n = 0; n < size; n++) { -// if (n != 0) System.out.print(','); -// System.out.print(positions[n]); -// } -// System.out.println(']'); return positions; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java index 9d1a6e9b67b..d7445a7a627 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java @@ -774,8 +774,8 @@ void removeFinalAssignmentIfAny(Reference reference) { */ public void simulateThrowAfterLoopBack(FlowInfo flowInfo) { if (this.escapingExceptionCatchSites != null) { - for (Object element : this.escapingExceptionCatchSites) { - ((EscapingExceptionCatchSite) element).simulateThrowAfterLoopBack(flowInfo); + for (Object site : this.escapingExceptionCatchSites) { + ((EscapingExceptionCatchSite) site).simulateThrowAfterLoopBack(flowInfo); } this.escapingExceptionCatchSites = null; // don't care for it anymore. } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java index 0cfe87b5370..a282b6f083d 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java @@ -120,11 +120,11 @@ void cachePartsFrom(IBinaryModule module) { this.requiresTransitive = new ModuleBinding[requiresReferences.length]; int count = 0; int transitiveCount = 0; - for (IModuleReference element : requiresReferences) { - ModuleBinding requiredModule = this.environment.getModule(element.name()); + for (IModuleReference ref : requiresReferences) { + ModuleBinding requiredModule = this.environment.getModule(ref.name()); if (requiredModule != null) { this.requires[count++] = requiredModule; - if (element.isTransitive()) + if (ref.isTransitive()) this.requiresTransitive[transitiveCount++] = requiredModule; } // TODO(SHMOD): handle null case diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java index 765780752c6..87806b36676 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java @@ -366,9 +366,9 @@ public FieldBinding[] availableFields() { } FieldBinding[] availableFields = new FieldBinding[this.fields.length]; int count = 0; - for (FieldBinding field2 : this.fields) { + for (FieldBinding field : this.fields) { try { - availableFields[count] = resolveTypeFor(field2); + availableFields[count] = resolveTypeFor(field); count++; } catch (AbortCompilation a){ // silent abort @@ -427,9 +427,9 @@ public MethodBinding[] availableMethods() { } MethodBinding[] availableMethods = new MethodBinding[this.methods.length]; int count = 0; - for (MethodBinding method2 : this.methods) { + for (MethodBinding method : this.methods) { try { - availableMethods[count] = resolveTypesFor(method2); + availableMethods[count] = resolveTypesFor(method); count++; } catch (AbortCompilation a){ // silent abort @@ -615,14 +615,12 @@ void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) { IBinaryMethod[] iMethods = createMethods(binaryType.getMethods(), binaryType, sourceLevel, missingTypeNames); boolean isViewedAsDeprecated = isViewedAsDeprecated(); if (isViewedAsDeprecated) { - for (FieldBinding field2 : this.fields) { - FieldBinding field = field2; + for (FieldBinding field : this.fields) { if (!field.isDeprecated()) { field.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; } } - for (MethodBinding method2 : this.methods) { - MethodBinding method = method2; + for (MethodBinding method : this.methods) { if (!method.isDeprecated()) { method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; } @@ -2674,8 +2672,8 @@ public String toString() { if (this.fields != null) { if (this.fields != Binding.NO_FIELDS) { buffer.append("\n/* fields */"); //$NON-NLS-1$ - for (FieldBinding field2 : this.fields) - buffer.append((field2 != null) ? "\n" + field2.toString() : "\nNULL FIELD"); //$NON-NLS-1$ //$NON-NLS-2$ + for (FieldBinding field : this.fields) + buffer.append((field != null) ? "\n" + field.toString() : "\nNULL FIELD"); //$NON-NLS-1$ //$NON-NLS-2$ } } else { buffer.append("NULL FIELDS"); //$NON-NLS-1$ @@ -2684,8 +2682,8 @@ public String toString() { if (this.methods != null) { if (this.methods != Binding.NO_METHODS) { buffer.append("\n/* methods */"); //$NON-NLS-1$ - for (MethodBinding method2 : this.methods) - buffer.append((method2 != null) ? "\n" + method2.toString() : "\nNULL METHOD"); //$NON-NLS-1$ //$NON-NLS-2$ + for (MethodBinding method : this.methods) + buffer.append((method != null) ? "\n" + method.toString() : "\nNULL METHOD"); //$NON-NLS-1$ //$NON-NLS-2$ } } else { buffer.append("NULL METHODS"); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java index 05f2d0fb6f9..aa7becf4a42 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java @@ -1399,8 +1399,8 @@ public void checkAppropriateMethodAgainstSupers(char[] selector, MethodBinding c if (checkAppropriate(compileTimeMethod, otherMethod, site)) { ReferenceBinding[] superInterfaces = enclosingType.superInterfaces(); if (superInterfaces != null) { - for (ReferenceBinding element : superInterfaces) { - otherMethod = getMethod(element, selector, parameters, site); + for (ReferenceBinding superInterface : superInterfaces) { + otherMethod = getMethod(superInterface, selector, parameters, site); if (!checkAppropriate(compileTimeMethod, otherMethod, site)) break; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java index 579a2282607..ae472581238 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java @@ -283,16 +283,16 @@ TypeBinding combineAndUseNullHints(TypeBinding type, long nullHints, LookupEnvir // TODO(optimization): may want to collect all nullHints in the ThreeSets, which, however, // needs a reference TypeBound->ThreeSets to propagate the bits as they are added. if (this.sameBounds != null) { - for (TypeBound element : this.sameBounds) - nullHints |= element.nullHints; + for (TypeBound bound : this.sameBounds) + nullHints |= bound.nullHints; } if (this.superBounds != null) { - for (TypeBound element : this.superBounds) - nullHints |= element.nullHints; + for (TypeBound bound : this.superBounds) + nullHints |= bound.nullHints; } if (this.subBounds != null) { - for (TypeBound element : this.subBounds) - nullHints |= element.nullHints; + for (TypeBound bound : this.subBounds) + nullHints |= bound.nullHints; } if (nullHints == TagBits.AnnotationNullMASK) // on contradiction remove null type annotations return type.withoutToplevelNullAnnotation(); @@ -537,57 +537,55 @@ boolean incorporate(InferenceContext18 context, TypeBound [] first, TypeBound [] boolean analyzeNull = context.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled; ConstraintTypeFormula [] mostRecentFormulas = new ConstraintTypeFormula[4]; // poor man's cache to toss out duplicates, in pathological cases there are a good quarter million of them. // check each pair, in each way. - for (TypeBound element : first) { - TypeBound boundI = element; - for (TypeBound element2 : next) { - TypeBound boundJ = element2; - if (boundI == boundJ) + for (TypeBound bound1 : first) { + for (TypeBound bound2 : next) { + if (bound1 == bound2) continue; int iteration = 1; do { ConstraintTypeFormula newConstraint = null; boolean deriveTypeArgumentConstraints = false; if (iteration == 2) { - TypeBound boundX = boundI; - boundI = boundJ; - boundJ = boundX; + TypeBound boundX = bound1; + bound1 = bound2; + bound2 = boundX; } - switch (boundI.relation) { + switch (bound1.relation) { case ReductionResult.SAME: - switch (boundJ.relation) { + switch (bound2.relation) { case ReductionResult.SAME: - newConstraint = combineSameSame(boundI, boundJ, first, next); + newConstraint = combineSameSame(bound1, bound2, first, next); break; case ReductionResult.SUBTYPE: case ReductionResult.SUPERTYPE: - newConstraint = combineSameSubSuper(boundI, boundJ, first, next); + newConstraint = combineSameSubSuper(bound1, bound2, first, next); break; } break; case ReductionResult.SUBTYPE: - switch (boundJ.relation) { + switch (bound2.relation) { case ReductionResult.SAME: - newConstraint = combineSameSubSuper(boundJ, boundI, first, next); + newConstraint = combineSameSubSuper(bound2, bound1, first, next); break; case ReductionResult.SUPERTYPE: - newConstraint = combineSuperAndSub(boundJ, boundI); + newConstraint = combineSuperAndSub(bound2, bound1); break; case ReductionResult.SUBTYPE: - newConstraint = combineEqualSupers(boundI, boundJ); - deriveTypeArgumentConstraints = TypeBinding.equalsEquals(boundI.left, boundJ.left); + newConstraint = combineEqualSupers(bound1, bound2); + deriveTypeArgumentConstraints = TypeBinding.equalsEquals(bound1.left, bound2.left); break; } break; case ReductionResult.SUPERTYPE: - switch (boundJ.relation) { + switch (bound2.relation) { case ReductionResult.SAME: - newConstraint = combineSameSubSuper(boundJ, boundI, first, next); + newConstraint = combineSameSubSuper(bound2, bound1, first, next); break; case ReductionResult.SUBTYPE: - newConstraint = combineSuperAndSub(boundI, boundJ); + newConstraint = combineSuperAndSub(bound1, bound2); break; case ReductionResult.SUPERTYPE: - newConstraint = combineEqualSupers(boundI, boundJ); + newConstraint = combineEqualSupers(bound1, bound2); break; } } @@ -614,16 +612,16 @@ boolean incorporate(InferenceContext18 context, TypeBound [] first, TypeBound [] // record all null tagBits as hints for the final inference solution. long nullHints = (newConstraint.left.tagBits | newConstraint.right.tagBits) & TagBits.AnnotationNullMASK; if (nullHints != 0) { - if (TypeBinding.equalsEquals(boundI.left, boundJ.left) - || (boundI.relation == ReductionResult.SAME && TypeBinding.equalsEquals(boundI.right, boundJ.left)) - || (boundJ.relation == ReductionResult.SAME && TypeBinding.equalsEquals(boundI.left, boundJ.right))) { - boundI.nullHints |= nullHints; - boundJ.nullHints |= nullHints; + if (TypeBinding.equalsEquals(bound1.left, bound2.left) + || (bound1.relation == ReductionResult.SAME && TypeBinding.equalsEquals(bound1.right, bound2.left)) + || (bound2.relation == ReductionResult.SAME && TypeBinding.equalsEquals(bound1.left, bound2.right))) { + bound1.nullHints |= nullHints; + bound2.nullHints |= nullHints; } } } } - ConstraintFormula[] typeArgumentConstraints = deriveTypeArgumentConstraints ? deriveTypeArgumentConstraints(boundI, boundJ) : null; + ConstraintFormula[] typeArgumentConstraints = deriveTypeArgumentConstraints ? deriveTypeArgumentConstraints(bound1, bound2) : null; if (typeArgumentConstraints != null) { for (ConstraintFormula typeArgumentConstraint : typeArgumentConstraints) { if (!reduceOneConstraint(context, typeArgumentConstraint)) @@ -631,9 +629,9 @@ boolean incorporate(InferenceContext18 context, TypeBound [] first, TypeBound [] } } if (iteration == 2) { - TypeBound boundX = boundI; - boundI = boundJ; - boundJ = boundX; + TypeBound boundX = bound1; + bound1 = bound2; + bound2 = boundX; } } while (first != next && ++iteration <= 2); } @@ -991,10 +989,9 @@ public boolean reduceOneConstraint(InferenceContext18 context, ConstraintFormula if (result instanceof ConstraintFormula) { if (!reduceOneConstraint(context, (ConstraintFormula) result)) return false; - } else if (result instanceof ConstraintFormula[]) { - ConstraintFormula[] resultArray = (ConstraintFormula[]) result; - for (ConstraintFormula element : resultArray) - if (!reduceOneConstraint(context, element)) + } else if (result instanceof ConstraintFormula[] resultArray) { + for (ConstraintFormula formula : resultArray) + if (!reduceOneConstraint(context, formula)) return false; } else { addBound((TypeBound)result, context.environment); @@ -1137,13 +1134,13 @@ TypeBinding[] lowerBounds(InferenceVariable variable, boolean onlyProper) { public String toString() { StringBuilder buf = new StringBuilder("Type Bounds:\n"); //$NON-NLS-1$ TypeBound[] flattened = flatten(); - for (TypeBound element : flattened) { - buf.append('\t').append(element.toString()).append('\n'); + for (TypeBound bound : flattened) { + buf.append('\t').append(bound.toString()).append('\n'); } buf.append("Capture Bounds:\n"); //$NON-NLS-1$ - for (Entry capt : this.captures.entrySet()) { - String lhs = String.valueOf(((TypeBinding)capt.getKey()).shortReadableName()); - String rhs = String.valueOf(((TypeBinding)capt.getValue()).shortReadableName()); + for (Entry entry : this.captures.entrySet()) { + String lhs = String.valueOf(((TypeBinding)entry.getKey()).shortReadableName()); + String rhs = String.valueOf(((TypeBinding)entry.getValue()).shortReadableName()); buf.append('\t').append(lhs).append(" = capt(").append(rhs).append(")\n"); //$NON-NLS-1$ //$NON-NLS-2$ } return buf.toString(); @@ -1252,8 +1249,8 @@ protected TypeBinding[] superTypesWithCommonGenericType(TypeBinding s, TypeBindi return result; ReferenceBinding[] superInterfaces = s.superInterfaces(); if (superInterfaces != null) { - for (ReferenceBinding element : superInterfaces) { - result = superTypesWithCommonGenericType(element, t); + for (ReferenceBinding superInterface : superInterfaces) { + result = superTypesWithCommonGenericType(superInterface, t); if (result != null) return result; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java index de547e21f0a..ccb9a4aefca 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java @@ -1601,8 +1601,7 @@ private boolean detectHierarchyCycle(SourceTypeBinding sourceType, ReferenceBind ReferenceBinding[] itsInterfaces = superType.superInterfaces(); if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { - for (ReferenceBinding element : itsInterfaces) { - ReferenceBinding anInterface = element; + for (ReferenceBinding anInterface : itsInterfaces) { if (TypeBinding.equalsEquals(sourceType, anInterface)) { problemReporter().hierarchyCircularity(sourceType, superType, reference); sourceType.tagBits |= TagBits.HierarchyHasProblems; @@ -1640,8 +1639,7 @@ private boolean detectHierarchyCycle(SourceTypeBinding sourceType, ReferenceBind // https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885 Don't cry foul prematurely. // Check the edges traversed to see if there really is a cycle. char [] referredName = ref.getLastToken(); - for (Object element : environment().typesBeingConnected) { - SourceTypeBinding type = (SourceTypeBinding) element; + for (SourceTypeBinding type : environment().typesBeingConnected) { if (CharOperation.equals(referredName, type.sourceName())) { problemReporter().hierarchyCircularity(sourceType, superType, reference); sourceType.tagBits |= TagBits.HierarchyHasProblems; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java index e50bc838bb7..dec50d0f7a3 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java @@ -970,8 +970,8 @@ public void storeDependencyInfo() { recordSuperTypeReference(superclass); ReferenceBinding[] interfaces = type.superInterfaces(); if (interfaces != null) - for (ReferenceBinding element : interfaces) - recordSuperTypeReference(element); + for (ReferenceBinding binding : interfaces) + recordSuperTypeReference(binding); } for (ReferenceBindingSetWrapper wrapper : this.referencedTypes) { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ConstraintExceptionFormula.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ConstraintExceptionFormula.java index ac577445f0d..37cb04ee363 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ConstraintExceptionFormula.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ConstraintExceptionFormula.java @@ -73,9 +73,9 @@ public Object reduce(InferenceContext18 inferenceContext) { TypeBinding[] thrown = sam.thrownExceptions; InferenceVariable[] e = new InferenceVariable[thrown.length]; int n = 0; - for (TypeBinding element : thrown) - if (!element.isProperType(true)) - e[n++] = (InferenceVariable) element; // thrown[i] is not a proper type, since it's an exception it must be an inferenceVariable, right? + for (TypeBinding ex : thrown) + if (!ex.isProperType(true)) + e[n++] = (InferenceVariable) ex; // thrown[i] is not a proper type, since it's an exception it must be an inferenceVariable, right? /* If throw specification does not encode any type parameters, there are no constraints to be gleaned/gathered from the throw sites. See also that thrown exceptions are not allowed to influence compatibility and overload resolution. @@ -103,8 +103,8 @@ public Object reduce(InferenceContext18 inferenceContext) { actual: for (int i = 0; i < m; i++) { if (ePrime[i].isUncheckedException(false)) continue; - for (TypeBinding element : thrown) - if (element.isProperType(true) && ePrime[i].isCompatibleWith(element)) + for (TypeBinding ex : thrown) + if (ex.isProperType(true) && ePrime[i].isCompatibleWith(ex)) continue actual; for (int j = 0; j < n; j++) result.add(ConstraintTypeFormula.create(ePrime[i], e[j], SUBTYPE)); diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceContext.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceContext.java index 1d1c07be8bf..b3a9b0b0d49 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceContext.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceContext.java @@ -106,7 +106,7 @@ public String toString() { for (int j = TypeConstants.CONSTRAINT_EQUAL; j <= TypeConstants.CONSTRAINT_SUPER; j++) { TypeBinding[] constraintCollected = collected[j]; if (constraintCollected != null) { - for (TypeBinding element : constraintCollected) { + for (TypeBinding binding : constraintCollected) { buffer.append("\n\t\t").append(this.genericMethod.typeVariables[i].sourceName); //$NON-NLS-1$ switch (j) { case TypeConstants.CONSTRAINT_EQUAL : @@ -119,8 +119,8 @@ public String toString() { buffer.append(">:"); //$NON-NLS-1$ break; } - if (element != null) { - buffer.append(element.shortReadableName()); + if (binding != null) { + buffer.append(binding.shortReadableName()); } } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java index a9ec5eb6f74..5adcf8395d5 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java @@ -909,8 +909,8 @@ private Boolean moreSpecificMain(TypeBinding si, TypeBinding ti, Expression expr return null; // bullet 4 // each element of the intersection is a superinterface of I, or a parameterization of a superinterface of I. } - for (TypeBinding element : elements) - if (siSubI(element, funcI)) + for (TypeBinding binding : elements) + if (siSubI(binding, funcI)) return null; // bullet 5 // some element of the intersection is a subinterface of I, or a parameterization of a subinterface of I. } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java index 1d492e64c63..d8b4f992c7c 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java @@ -1408,22 +1408,22 @@ public TypeBinding createAnnotatedType(TypeBinding type, AnnotationBinding[] new long tagBitsSeen = 0; AnnotationBinding[] filtered = new AnnotationBinding[newbies.length]; int count = 0; - for (AnnotationBinding element : newbies) { - if (element == null) { + for (AnnotationBinding newbie : newbies) { + if (newbie == null) { filtered[count++] = null; // reset tagBitsSeen for next array dimension tagBitsSeen = 0; continue; } long tagBits = 0; - if (element.type.hasNullBit(TypeIds.BitNonNullAnnotation)) { + if (newbie.type.hasNullBit(TypeIds.BitNonNullAnnotation)) { tagBits = TagBits.AnnotationNonNull; - } else if (element.type.hasNullBit(TypeIds.BitNullableAnnotation)) { + } else if (newbie.type.hasNullBit(TypeIds.BitNullableAnnotation)) { tagBits = TagBits.AnnotationNullable; } if ((tagBitsSeen & tagBits) == 0) { tagBitsSeen |= tagBits; - filtered[count++] = element; + filtered[count++] = newbie; } } if (count < newbies.length) @@ -2058,8 +2058,8 @@ boolean qualifiedNameMatchesSignature(char[][] name, char[] signature) { int s = 1; // skip 'L' for (int i = 0; i < name.length; i++) { char[] n = name[i]; - for (char element : n) - if (element != signature[s++]) + for (char c : n) + if (c != signature[s++]) return false; if (signature[s] == ';' && i == name.length-1) return true; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java index 6e7c5c4c81d..b7795cfa4f8 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java @@ -425,8 +425,8 @@ public List collectMissingTypes(List missingTypes) { for (TypeVariableBinding variable : this.typeVariables) { missingTypes = variable.superclass().collectMissingTypes(missingTypes); ReferenceBinding[] interfaces = variable.superInterfaces(); - for (ReferenceBinding element : interfaces) { - missingTypes = element.collectMissingTypes(missingTypes); + for (ReferenceBinding binding : interfaces) { + missingTypes = binding.collectMissingTypes(missingTypes); } } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java index a086e060bd6..2404a4e6cbc 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java @@ -584,8 +584,8 @@ void computeInheritedMethods(ReferenceBinding superclass, ReferenceBinding[] sup } else { MethodBinding[] nonVisible = (MethodBinding[]) nonVisibleDefaultMethods.get(inheritedMethod.selector); if (nonVisible != null && inheritedMethod.isAbstract()) - for (MethodBinding element : nonVisible) - if (areMethodsCompatible(element, inheritedMethod)) + for (MethodBinding binding : nonVisible) + if (areMethodsCompatible(binding, inheritedMethod)) continue nextMethod; if (nonVisible == null) { nonVisible = new MethodBinding[] {inheritedMethod}; @@ -932,8 +932,8 @@ static boolean hasGenericParameter(MethodBinding method) { // may be only the return type that is generic, need to check parameters TypeBinding[] params = method.parameters; - for (TypeBinding param2 : params) { - TypeBinding param = param2.leafComponentType(); + for (TypeBinding binding : params) { + TypeBinding param = binding.leafComponentType(); if (param instanceof ReferenceBinding) { int modifiers = ((ReferenceBinding) param).modifiers; if ((modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java index dda2b4c5f5f..c2565c9448f 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java @@ -798,23 +798,23 @@ public String toString() { } if (this.uses != null && this.uses.length > 0) { buffer.append("\n/* uses /*\n"); //$NON-NLS-1$ - for (TypeBinding element : this.uses) { + for (TypeBinding binding : this.uses) { buffer.append("\n\t"); //$NON-NLS-1$ - buffer.append(element.debugName()); + buffer.append(binding.debugName()); } } else { buffer.append("\nNo Uses"); //$NON-NLS-1$ } if (this.services != null && this.services.length > 0) { buffer.append("\n/* Services */\n"); //$NON-NLS-1$ - for (TypeBinding element : this.services) { + for (TypeBinding binding : this.services) { buffer.append("\n\t"); //$NON-NLS-1$ buffer.append("provides "); //$NON-NLS-1$ - buffer.append(element.debugName()); + buffer.append(binding.debugName()); buffer.append(" with "); //$NON-NLS-1$ - if (this.implementations != null && this.implementations.containsKey(element)) { + if (this.implementations != null && this.implementations.containsKey(binding)) { String sep = ""; //$NON-NLS-1$ - for (TypeBinding impl : this.implementations.get(element)) { + for (TypeBinding impl : this.implementations.get(binding)) { buffer.append(sep).append(impl.debugName()); sep = ", "; //$NON-NLS-1$ } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java index bd987a14147..6f4940b978d 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java @@ -733,8 +733,8 @@ private ParameterizedGenericMethodBinding inferFromExpectedType(Scope scope, Inf if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution } } - for (ReferenceBinding element : originalVariable.superInterfaces) { - TypeBinding substitutedBound = Scope.substitute(this, element); + for (ReferenceBinding superInterface : originalVariable.superInterfaces) { + TypeBinding substitutedBound = Scope.substitute(this, superInterface); argument.collectSubstitutes(scope, substitutedBound, inferenceContext, TypeConstants.CONSTRAINT_SUPER); if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution // JLS 15.12.2.8 claims reverse inference shouldn't occur, however it improves inference diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java index ef5c09d0cfa..7ecbcad0d3b 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java @@ -1645,8 +1645,8 @@ public String toString() { if (this.fields != null) { if (this.fields != Binding.NO_FIELDS) { buffer.append("\n/* fields */"); //$NON-NLS-1$ - for (FieldBinding field2 : this.fields) - buffer.append('\n').append((field2 != null) ? field2.toString() : "NULL FIELD"); //$NON-NLS-1$ + for (FieldBinding field : this.fields) + buffer.append('\n').append((field != null) ? field.toString() : "NULL FIELD"); //$NON-NLS-1$ } } else { buffer.append("NULL FIELDS"); //$NON-NLS-1$ @@ -1655,8 +1655,8 @@ public String toString() { if (this.methods != null) { if (this.methods != Binding.NO_METHODS) { buffer.append("\n/* methods */"); //$NON-NLS-1$ - for (MethodBinding method2 : this.methods) - buffer.append('\n').append((method2 != null) ? method2.toString() : "NULL METHOD"); //$NON-NLS-1$ + for (MethodBinding method : this.methods) + buffer.append('\n').append((method != null) ? method.toString() : "NULL METHOD"); //$NON-NLS-1$ } } else { buffer.append("NULL METHODS"); //$NON-NLS-1$ @@ -1765,8 +1765,7 @@ public MethodBinding getSingleAbstractMethod(final Scope scope, boolean replaceW } ReferenceBinding substitutedDeclaringType = (ReferenceBinding) declaringType.findSuperTypeOriginatingFrom(theAbstractMethod.declaringClass); MethodBinding [] choices = substitutedDeclaringType.getMethods(theAbstractMethod.selector); - for (MethodBinding element : choices) { - MethodBinding method = element; + for (MethodBinding method : choices) { if (!method.isAbstract() || method.redeclaresPublicObjectMethod(scope)) continue; // (re)skip statics, defaults, public object methods ... if (method.problemId() == ProblemReasons.ContradictoryNullAnnotations) method = ((ProblemMethodBinding) method).closestMatch; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java index 0d5fa87dcad..0cf8e912f9a 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java @@ -984,8 +984,8 @@ public void computeId(LookupEnvironment environment) { environment.getUnannotatedType(this); } -/**{@code - * p.X -> Lp/X; +/**{@code + * p.X -> Lp/X; * } */ @Override @@ -1058,8 +1058,8 @@ public final ReferenceBinding enclosingTypeAt(int relativeDepth) { public int enumConstantCount() { int count = 0; FieldBinding[] fields = fields(); - for (FieldBinding field2 : fields) { - if ((field2.modifiers & ClassFileConstants.AccEnum) != 0) count++; + for (FieldBinding field : fields) { + if ((field.modifiers & ClassFileConstants.AccEnum) != 0) count++; } return count; } @@ -1601,8 +1601,8 @@ protected boolean isSubTypeOfRTL(TypeBinding other) { if (other instanceof ReferenceBinding) { TypeBinding[] intersecting = ((ReferenceBinding) other).getIntersectingTypes(); if (intersecting != null) { - for (TypeBinding element : intersecting) { - if (!isSubtypeOf(element, false)) + for (TypeBinding binding : intersecting) { + if (!isSubtypeOf(binding, false)) return false; } return true; @@ -2272,9 +2272,9 @@ public void detectWrapperResource() { int contractsLength = 0; ReferenceBinding [] superInterfaces = superInterfaces(); - for (ReferenceBinding element : superInterfaces) { + for (ReferenceBinding superInterface : superInterfaces) { // filterDefaultMethods=false => keep default methods needed to filter out any abstract methods they may override: - MethodBinding [] superInterfaceContracts = element.getInterfaceAbstractContracts(scope, replaceWildcards, false); + MethodBinding [] superInterfaceContracts = superInterface.getInterfaceAbstractContracts(scope, replaceWildcards, false); final int superInterfaceContractsLength = superInterfaceContracts == null ? 0 : superInterfaceContracts.length; if (superInterfaceContractsLength == 0) continue; if (contractsLength < contractsCount + superInterfaceContractsLength) { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java index 0a7f7bbdee0..efcc7800166 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java @@ -135,8 +135,8 @@ private static class NullDefaultRange { } boolean contains(Annotation annotation) { - for (Annotation annotation2 : this.annotations) { - if (annotation2 == annotation) + for (Annotation a : this.annotations) { + if (a == annotation) return true; } return false; @@ -1262,8 +1262,8 @@ protected MethodBinding findDefaultAbstractMethod( if (compatibleMethod != null) { if (compatibleMethod.isValidBinding()) { if (concreteMatches != null) { - for (MethodBinding element : concreteMatches) { - if (methodVerifier.areMethodsCompatible(element, compatibleMethod)) + for (MethodBinding concreteMatch : concreteMatches) { + if (methodVerifier.areMethodsCompatible(concreteMatch, compatibleMethod)) continue; // can skip this method since concreteMatch overrides it } } @@ -4071,8 +4071,8 @@ private TypeBinding leastContainingInvocation(TypeBinding mec, Object invocation // infer proper parameterized type from invocations TypeBinding[] bestArguments = new TypeBinding[argLength]; - for (TypeBinding invocation2 : invocations) { - TypeBinding invocation = invocation2.leafComponentType(); + for (TypeBinding binding : invocations) { + TypeBinding invocation = binding.leafComponentType(); switch (invocation.kind()) { case Binding.GENERIC_TYPE : TypeVariableBinding[] invocationVariables = invocation.typeVariables(); @@ -4433,8 +4433,8 @@ protected TypeBinding[] minimalErasedCandidates(TypeBinding[] types, Map allInvo int superLength = typesToVisit.size(); TypeBinding[] erasedSuperTypes = new TypeBinding[superLength]; int rank = 0; - for (Object element : typesToVisit) { - TypeBinding type = (TypeBinding)element; + for (Object typeToVisit : typesToVisit) { + TypeBinding type = (TypeBinding)typeToVisit; leafType = type.leafComponentType(); erasedSuperTypes[rank++] = (leafType.isTypeVariable() || leafType.isWildcard() /*&& !leafType.isCapture()*/) ? type : type.erasure(); } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java index 342a74ab4a6..8a95de66160 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java @@ -1618,8 +1618,8 @@ public char[] genericSignature() { sig.append(this.superclass.genericTypeSignature()); else // interface scenario only (as Object cannot be generic) - 65953 sig.append(this.scope.getJavaLangObject().genericTypeSignature()); - for (ReferenceBinding element : this.superInterfaces) - sig.append(element.genericTypeSignature()); + for (ReferenceBinding superInterface : this.superInterfaces) + sig.append(superInterface.genericTypeSignature()); return sig.toString().toCharArray(); } @@ -3493,8 +3493,8 @@ public String toString() { if (this.fields != null) { if (this.fields != Binding.NO_FIELDS) { buffer.append("\n/* fields */"); //$NON-NLS-1$ - for (FieldBinding field2 : this.fields) - buffer.append('\n').append((field2 != null) ? field2.toString() : "NULL FIELD"); //$NON-NLS-1$ + for (FieldBinding field : this.fields) + buffer.append('\n').append((field != null) ? field.toString() : "NULL FIELD"); //$NON-NLS-1$ } } else { buffer.append("NULL FIELDS"); //$NON-NLS-1$ @@ -3503,8 +3503,8 @@ public String toString() { if (this.methods != null) { if (this.methods != Binding.NO_METHODS) { buffer.append("\n/* methods */"); //$NON-NLS-1$ - for (MethodBinding method2 : this.methods) - buffer.append('\n').append((method2 != null) ? method2.toString() : "NULL METHOD"); //$NON-NLS-1$ + for (MethodBinding method : this.methods) + buffer.append('\n').append((method != null) ? method.toString() : "NULL METHOD"); //$NON-NLS-1$ } } else { buffer.append("NULL METHODS"); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java index 921b27977d2..2e5b6955bce 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java @@ -202,8 +202,8 @@ private TypeConstants.BoundCheckStatus internalBoundCheck(Substitution substitut } } boolean mustImplement = isArrayBound || ((ReferenceBinding)wildcardBound).isFinal(); - for (ReferenceBinding element : this.superInterfaces) { - TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, element) : element; + for (ReferenceBinding superInterface : this.superInterfaces) { + TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, superInterface) : superInterface; if (!checkedAsOK) { if (isArrayBound) { if (!wildcardBound.isCompatibleWith(substitutedSuperType, scope)) @@ -277,8 +277,8 @@ private TypeConstants.BoundCheckStatus internalBoundCheck(Substitution substitut nullStatus = nullBoundCheck(scope, argumentType, substitutedSuperType, substitution, location, nullStatus); } } - for (ReferenceBinding element : this.superInterfaces) { - TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, element) : element; + for (ReferenceBinding superInterface : this.superInterfaces) { + TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, superInterface) : superInterface; if (TypeBinding.notEquals(substitutedSuperType, argumentType)) { if (!argumentType.isCompatibleWith(substitutedSuperType, scope)) { return BoundCheckStatus.MISMATCH; @@ -514,8 +514,8 @@ TypeBound[] getTypeBounds(InferenceVariable variable, InferenceSubstitution thet int idx = 0; if (!this.firstBound.isInterface()) bounds[idx++] = TypeBound.createBoundOrDependency(theta, this.firstBound, variable); - for (ReferenceBinding element : this.superInterfaces) - bounds[idx++] = TypeBound.createBoundOrDependency(theta, element, variable); + for (ReferenceBinding superInterface : this.superInterfaces) + bounds[idx++] = TypeBound.createBoundOrDependency(theta, superInterface, variable); return bounds; } @@ -525,8 +525,8 @@ boolean hasOnlyRawBounds() { return false; if (this.superInterfaces != null) - for (ReferenceBinding element : this.superInterfaces) - if (!element.isRawType()) + for (ReferenceBinding superInterface : this.superInterfaces) + if (!superInterface.isRawType()) return false; return true; @@ -540,9 +540,9 @@ public boolean hasTypeBit(int bit) { if (this.superclass != null && this.superclass.hasTypeBit(~TypeIds.BitUninitialized)) this.typeBits |= (this.superclass.typeBits & TypeIds.InheritableBits); if (this.superInterfaces != null) - for (ReferenceBinding element : this.superInterfaces) - if (element.hasTypeBit(~TypeIds.BitUninitialized)) - this.typeBits |= (element.typeBits & TypeIds.InheritableBits); + for (ReferenceBinding superInterface : this.superInterfaces) + if (superInterface.hasTypeBit(~TypeIds.BitUninitialized)) + this.typeBits |= (superInterface.typeBits & TypeIds.InheritableBits); } return (this.typeBits & bit) != 0; } @@ -553,8 +553,8 @@ public boolean hasTypeBit(int bit) { public boolean isErasureBoundTo(TypeBinding type) { if (TypeBinding.equalsEquals(this.superclass.erasure(), type)) return true; - for (ReferenceBinding element : this.superInterfaces) { - if (TypeBinding.equalsEquals(element.erasure(), type)) + for (ReferenceBinding superInterface : this.superInterfaces) { + if (TypeBinding.equalsEquals(superInterface.erasure(), type)) return true; } return false; @@ -598,8 +598,8 @@ public boolean isSubtypeOf(TypeBinding other, boolean simulatingBugJDK8026527) { if (this.superclass != null && this.superclass.isSubtypeOf(other, simulatingBugJDK8026527)) return true; if (this.superInterfaces != null) - for (ReferenceBinding element : this.superInterfaces) - if (element.isSubtypeOf(other, false)) + for (ReferenceBinding superInterface : this.superInterfaces) + if (superInterface.isSubtypeOf(other, false)) return true; return other.id == TypeIds.T_JavaLangObject; } @@ -644,8 +644,8 @@ public boolean isProperType(boolean admitCapture18) { return false; } if (this.superInterfaces != null) - for (ReferenceBinding element : this.superInterfaces) - if (!element.isProperType(admitCapture18)) { + for (ReferenceBinding superInterface : this.superInterfaces) + if (!superInterface.isProperType(admitCapture18)) { return false; } return true; @@ -741,8 +741,8 @@ public boolean mentionsAny(TypeBinding[] parameters, int idx) { if (this.superclass != null && this.superclass.mentionsAny(parameters, idx)) return true; if (this.superInterfaces != null) - for (ReferenceBinding element : this.superInterfaces) { - if (element.mentionsAny(parameters, idx)) + for (ReferenceBinding superInterface : this.superInterfaces) { + if (superInterface.mentionsAny(parameters, idx)) return true; } return false; @@ -760,8 +760,8 @@ void collectInferenceVariables(Set variables) { if (this.superclass != null) this.superclass.collectInferenceVariables(variables); if (this.superInterfaces != null) - for (ReferenceBinding element : this.superInterfaces) { - element.collectInferenceVariables(variables); + for (ReferenceBinding superInterface : this.superInterfaces) { + superInterface.collectInferenceVariables(variables); } } finally { this.inRecursiveFunction = false; @@ -1047,9 +1047,9 @@ private TypeReference findBound(TypeBinding bound, TypeParameter parameter) { return parameter.type; TypeReference[] bounds = parameter.bounds; if (bounds != null) { - for (TypeReference bound2 : bounds) { - if (TypeBinding.equalsEquals(bound2.resolvedType, bound)) - return bound2; + for (TypeReference ref : bounds) { + if (TypeBinding.equalsEquals(ref.resolvedType, bound)) + return ref; } } return null; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java index cb2b61b11fc..a2e14d3e1f6 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java @@ -628,9 +628,9 @@ public boolean hasTypeBit(int bit) { if (this.superclass != null && this.superclass.hasTypeBit(~TypeIds.BitUninitialized)) this.typeBits |= (this.superclass.typeBits & TypeIds.InheritableBits); if (this.superInterfaces != null) - for (ReferenceBinding element : this.superInterfaces) - if (element.hasTypeBit(~TypeIds.BitUninitialized)) - this.typeBits |= (element.typeBits & TypeIds.InheritableBits); + for (ReferenceBinding superInterface : this.superInterfaces) + if (superInterface.hasTypeBit(~TypeIds.BitUninitialized)) + this.typeBits |= (superInterface.typeBits & TypeIds.InheritableBits); } return (this.typeBits & bit) != 0; } @@ -719,8 +719,8 @@ public boolean isProperType(boolean admitCapture18) { if (this.superclass != null && !this.superclass.isProperType(admitCapture18)) return false; if (this.superInterfaces != null) - for (ReferenceBinding element : this.superInterfaces) - if (!element.isProperType(admitCapture18)) + for (ReferenceBinding superInterface : this.superInterfaces) + if (!superInterface.isProperType(admitCapture18)) return false; return true; } finally { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java index 8929a665dd7..2a81d0a1947 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java @@ -203,9 +203,9 @@ public static char[][][] levelTagsToChar3d(LevelTags[] input) { for( int i = 0; i < ret.length; i++ ) { ret[i] = new char[][] {}; } - for (LevelTags element : input) { - int nextLevel = element.level - ClassFileConstants.MAJOR_VERSION_0; - ret[nextLevel] = element.tags; + for (LevelTags tag : input) { + int nextLevel = tag.level - ClassFileConstants.MAJOR_VERSION_0; + ret[nextLevel] = tag.tags; } return ret; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java index 252c88f342c..8a649573031 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java @@ -190,8 +190,8 @@ public final static short base_check(int i) { } private final static void buildFile(String filename, List listToDump) { try (BufferedWriter writer = new BufferedWriter(new FileWriter(filename))) { - for (Object element : listToDump) { - writer.write(String.valueOf(element)); + for (Object o : listToDump) { + writer.write(String.valueOf(o)); } writer.flush(); } catch(IOException e) { @@ -2616,8 +2616,8 @@ protected void consumeClassHeaderImplements() { 0, length); TypeReference[] superinterfaces = typeDecl.superInterfaces; - for (TypeReference element : superinterfaces) { - TypeReference typeReference = element; + for (TypeReference superinterface : superinterfaces) { + TypeReference typeReference = superinterface; typeDecl.bits |= (typeReference.bits & ASTNode.HasTypeAnnotations); typeReference.bits |= ASTNode.IsSuperType; } @@ -4682,8 +4682,8 @@ protected void consumeInterfaceHeaderExtends() { 0, length); TypeReference[] superinterfaces = typeDecl.superInterfaces; - for (TypeReference element : superinterfaces) { - TypeReference typeReference = element; + for (TypeReference superinterface : superinterfaces) { + TypeReference typeReference = superinterface; typeDecl.bits |= (typeReference.bits & ASTNode.HasTypeAnnotations); typeReference.bits |= ASTNode.IsSuperType; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java index f382d404f61..b24d9b84b9e 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java @@ -2275,12 +2275,12 @@ private void reportPrimaryError(int msgCode, int nameIndex, int token, int scope } else { int[] template = getNTermTemplate(-tmpAddedToken); if(template != null) { - for (int element : template) { + for (int t : template) { int length = addedTokens.length; if(addedTokenCount == length) { System.arraycopy(addedTokens, 0, addedTokens = new int[length * 2], 0, length); } - addedTokens[addedTokenCount++] = element; + addedTokens[addedTokenCount++] = t; } } else { addedTokenCount = 0; @@ -2496,12 +2496,12 @@ private void reportSecondaryError(int msgCode, int nameIndex, int leftToken, int } else { int[] template = getNTermTemplate(-tmpAddedToken); if(template != null) { - for (int element : template) { + for (int t : template) { int length = addedTokens.length; if(addedTokenCount == length) { System.arraycopy(addedTokens, 0, addedTokens = new int[length * 2], 0, length); } - addedTokens[addedTokenCount++] = element; + addedTokens[addedTokenCount++] = t; } } else { addedTokenCount = 0; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java index d2e2ffecd6b..0e15c5d650e 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java @@ -5280,8 +5280,8 @@ private boolean isRecoveredName(char[] simpleName) { private boolean isRecoveredName(char[][] qualifiedName) { if(qualifiedName == null) return false; - for (char[] element : qualifiedName) { - if(element == RecoveryScanner.FAKE_IDENTIFIER) return true; + for (char[] segment : qualifiedName) { + if(segment == RecoveryScanner.FAKE_IDENTIFIER) return true; } return false; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java index 6e501398856..a8ed78c2a21 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java @@ -797,8 +797,7 @@ protected List getPlatformLocations(File file) { @Override protected void loggingExtraProblems() { super.loggingExtraProblems(); - for (Object element : this.extraProblems) { - final CategorizedProblem problem = (CategorizedProblem) element; + for (CategorizedProblem problem : this.extraProblems) { if (this.diagnosticListener != null && !isIgnored(problem)) { Diagnostic diagnostic = new Diagnostic<>() { @Override diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfModule.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfModule.java index 7f75f46d96d..ce0af579a2f 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfModule.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfModule.java @@ -102,8 +102,8 @@ public int size() { public String toString() { String s = ""; //$NON-NLS-1$ ModuleBinding pkg; - for (ModuleBinding element : this.valueTable) - if ((pkg = element) != null) + for (ModuleBinding binding : this.valueTable) + if ((pkg = binding) != null) s += pkg.toString() + "\n"; //$NON-NLS-1$ return s; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToInt.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToInt.java index 7d8cdfae0c7..74e49474665 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToInt.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToInt.java @@ -86,9 +86,9 @@ public int get(Object key) { public void keysToArray(Object[] array) { int index = 0; - for (Object element : this.keyTable) { - if (element != null) - array[index++] = element; + for (Object key : this.keyTable) { + if (key != null) + array[index++] = key; } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToIntArray.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToIntArray.java index 2132ecddcf2..f512f63d426 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToIntArray.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToIntArray.java @@ -86,9 +86,9 @@ public int[] get(Object key) { public void keysToArray(Object[] array) { int index = 0; - for (Object element : this.keyTable) { - if (element != null) - array[index++] = element; + for (Object key : this.keyTable) { + if (key != null) + array[index++] = key; } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java index f3980b566b7..5105e65db64 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java @@ -126,8 +126,8 @@ public int size() { public String toString() { String s = ""; //$NON-NLS-1$ ReferenceBinding type; - for (ReferenceBinding element : this.valueTable) - if ((type = element) != null) + for (ReferenceBinding binding : this.valueTable) + if ((type = binding) != null) s += type.toString() + "\n"; //$NON-NLS-1$ return s; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Sorting.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Sorting.java index fa488d59170..262cdcbfd6f 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Sorting.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Sorting.java @@ -56,8 +56,8 @@ private static int sort(ReferenceBinding[] input, int i, o = sortSuper(superclass, input, output, o); ReferenceBinding[] superInterfaces = input[i].superInterfaces(); - for (ReferenceBinding element : superInterfaces) { - o = sortSuper(element, input, output, o); + for (ReferenceBinding superInterface : superInterfaces) { + o = sortSuper(superInterface, input, output, o); } // done with supers, now input[i] can safely be transferred: diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java index 6232ce6a1d1..7d33bfd114e 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java @@ -604,8 +604,8 @@ public static int hashCode(Object[] array) { return 0; } int result = 1; - for (Object element : array) { - result = prime * result + (element == null ? 0 : element.hashCode()); + for (Object o : array) { + result = prime * result + (o == null ? 0 : o.hashCode()); } return result; } @@ -1116,8 +1116,8 @@ public static List collectPlatformLibraries(File javaHome) if (systemLibrariesJars != null) { for (File[] current : systemLibrariesJars) { if (current != null) { - for (File element : current) { - filePaths.add(element.getAbsolutePath()); + for (File file : current) { + filePaths.add(file.getAbsolutePath()); } } }