aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder/src/main
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:06:37 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:06:37 +0200
commit72194b7982ddfa8e9864d0a9934905bb76b90f33 (patch)
treeebed806c358c1a3960c5d6be4c13b26ca41809df /bcel-builder/src/main
parentc3289ab86bfb2c97cf34147239b3dde46de92a7c (diff)
downloadaspectj-72194b7982ddfa8e9864d0a9934905bb76b90f33.tar.gz
aspectj-72194b7982ddfa8e9864d0a9934905bb76b90f33.zip
'for' loop replaceable with enhanced 'for' loop
Reports for loops which iterate over collections or arrays, and can be replaced with an enhanced for loop (i.e. the foreach iteration syntax). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'bcel-builder/src/main')
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/AttributeUtils.java42
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/BootstrapMethods.java12
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Code.java35
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/FieldOrMethod.java3
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java58
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java25
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Module.java8
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ModulePackages.java8
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java40
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java3
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java4
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java3
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java7
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeTypeAnnos.java4
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/TypeAnnotationGen.java8
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java21
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java15
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionFactory.java8
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java28
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionSelect.java12
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java55
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ReferenceType.java8
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Type.java8
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/util/NonCachingClassLoaderRepository.java3
24 files changed, 199 insertions, 219 deletions
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/AttributeUtils.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/AttributeUtils.java
index 45d1597a7..d28a4f9f4 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/AttributeUtils.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/AttributeUtils.java
@@ -30,57 +30,57 @@ public class AttributeUtils {
file.writeShort(0);
} else {
file.writeShort(attributes.length);
- for (int i = 0; i < attributes.length; i++) {
- attributes[i].dump(file);
+ for (Attribute attribute : attributes) {
+ attribute.dump(file);
}
}
}
public static Signature getSignatureAttribute(Attribute[] attributes) {
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i].tag == Constants.ATTR_SIGNATURE) {
- return (Signature) attributes[i];
+ for (Attribute attribute : attributes) {
+ if (attribute.tag == Constants.ATTR_SIGNATURE) {
+ return (Signature) attribute;
}
}
return null;
}
public static Code getCodeAttribute(Attribute[] attributes) {
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i].tag == Constants.ATTR_CODE) {
- return (Code) attributes[i];
+ for (Attribute attribute : attributes) {
+ if (attribute.tag == Constants.ATTR_CODE) {
+ return (Code) attribute;
}
}
return null;
}
public static ExceptionTable getExceptionTableAttribute(Attribute[] attributes) {
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i].tag == Constants.ATTR_EXCEPTIONS) {
- return (ExceptionTable) attributes[i];
+ for (Attribute attribute : attributes) {
+ if (attribute.tag == Constants.ATTR_EXCEPTIONS) {
+ return (ExceptionTable) attribute;
}
}
return null;
}
public static ConstantValue getConstantValueAttribute(Attribute[] attributes) {
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i].getTag() == Constants.ATTR_CONSTANT_VALUE) {
- return (ConstantValue) attributes[i];
+ for (Attribute attribute : attributes) {
+ if (attribute.getTag() == Constants.ATTR_CONSTANT_VALUE) {
+ return (ConstantValue) attribute;
}
}
return null;
}
public static void accept(Attribute[] attributes, ClassVisitor visitor) {
- for (int i = 0; i < attributes.length; i++) {
- attributes[i].accept(visitor);
+ for (Attribute attribute : attributes) {
+ attribute.accept(visitor);
}
}
public static boolean hasSyntheticAttribute(Attribute[] attributes) {
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i].tag == Constants.ATTR_SYNTHETIC) {
+ for (Attribute attribute : attributes) {
+ if (attribute.tag == Constants.ATTR_SYNTHETIC) {
return true;
}
}
@@ -88,9 +88,9 @@ public class AttributeUtils {
}
public static SourceFile getSourceFileAttribute(Attribute[] attributes) {
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i].tag == Constants.ATTR_SOURCE_FILE) {
- return (SourceFile) attributes[i];
+ for (Attribute attribute : attributes) {
+ if (attribute.tag == Constants.ATTR_SOURCE_FILE) {
+ return (SourceFile) attribute;
}
}
return null;
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/BootstrapMethods.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/BootstrapMethods.java
index f708c0cab..699cdc3ef 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/BootstrapMethods.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/BootstrapMethods.java
@@ -133,8 +133,8 @@ public final class BootstrapMethods extends Attribute {
file.writeShort(bootstrapMethodRef);
int len = bootstrapArguments.length;
file.writeShort(len);
- for (int i=0;i<len;i++) {
- file.writeShort(bootstrapArguments[i]);
+ for (int bootstrapArgument : bootstrapArguments) {
+ file.writeShort(bootstrapArgument);
}
}
@@ -192,8 +192,8 @@ public final class BootstrapMethods extends Attribute {
} else {
int blen = bootstrapMethods.length;
file.writeShort(blen);
- for (int i = 0; i < blen; i++) {
- bootstrapMethods[i].dump(file);
+ for (BootstrapMethod bootstrapMethod : bootstrapMethods) {
+ bootstrapMethod.dump(file);
}
}
}
@@ -224,8 +224,8 @@ public final class BootstrapMethods extends Attribute {
int [] args = bm.getBootstrapArguments();
line.append(" argcount:").append(args==null?0:args.length).append(" ");
if (args!=null) {
- for (int a=0;a<args.length;a++) {
- line.append(args[a]).append("(").append(getConstantPool().getConstant(args[a])).append(") ");
+ for (int arg : args) {
+ line.append(arg).append("(").append(getConstantPool().getConstant(arg)).append(") ");
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Code.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Code.java
index b714e6cab..10dbf8ffc 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Code.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Code.java
@@ -173,13 +173,13 @@ public final class Code extends Attribute {
file.write(code, 0, code.length);
file.writeShort(exceptionTable.length);
- for (int i = 0; i < exceptionTable.length; i++) {
- exceptionTable[i].dump(file);
+ for (CodeException e : exceptionTable) {
+ e.dump(file);
}
file.writeShort(attributes.length);
- for (int i = 0; i < attributes.length; i++) {
- attributes[i].dump(file);
+ for (Attribute attribute : attributes) {
+ attribute.dump(file);
}
}
@@ -195,9 +195,9 @@ public final class Code extends Attribute {
* @return LineNumberTable of Code, if it has one
*/
public LineNumberTable getLineNumberTable() {
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i].tag == Constants.ATTR_LINE_NUMBER_TABLE) {
- return (LineNumberTable) attributes[i];
+ for (Attribute attribute : attributes) {
+ if (attribute.tag == Constants.ATTR_LINE_NUMBER_TABLE) {
+ return (LineNumberTable) attribute;
}
}
return null;
@@ -207,9 +207,9 @@ public final class Code extends Attribute {
* @return LocalVariableTable of Code, if it has one
*/
public LocalVariableTable getLocalVariableTable() {
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i].tag == Constants.ATTR_LOCAL_VARIABLE_TABLE) {
- return (LocalVariableTable) attributes[i];
+ for (Attribute attribute : attributes) {
+ if (attribute.tag == Constants.ATTR_LOCAL_VARIABLE_TABLE) {
+ return (LocalVariableTable) attribute;
}
}
return null;
@@ -262,8 +262,8 @@ public final class Code extends Attribute {
private final int calculateLength() {
int len = 0;
if (attributes != null) {
- for (int i = 0; i < attributes.length; i++) {
- len += attributes[i].length + 6 /* attribute header size */;
+ for (Attribute attribute : attributes) {
+ len += attribute.length + 6 /* attribute header size */;
}
}
return len + getInternalLength();
@@ -317,16 +317,16 @@ public final class Code extends Attribute {
if (exceptionTable.length > 0) {
buf.append("\nException handler(s) = \n" + "From\tTo\tHandler\tType\n");
- for (int i = 0; i < exceptionTable.length; i++) {
- buf.append(exceptionTable[i].toString(cpool, verbose) + "\n");
+ for (CodeException e : exceptionTable) {
+ buf.append(e.toString(cpool, verbose) + "\n");
}
}
if (attributes.length > 0) {
buf.append("\nAttribute(s) = \n");
- for (int i = 0; i < attributes.length; i++) {
- buf.append(attributes[i].toString() + "\n");
+ for (Attribute attribute : attributes) {
+ buf.append(attribute.toString() + "\n");
}
}
@@ -372,8 +372,7 @@ public final class Code extends Attribute {
codeString.append(Utility.codeToString(code, cpool, 0, -1, true));
if (exceptionTable.length > 0) {
codeString.append("\n").append("Exception entries = ").append(exceptionTable.length).append("\n");
- for (int i = 0; i < exceptionTable.length; i++) {
- CodeException exc = exceptionTable[i];
+ for (CodeException exc : exceptionTable) {
int type = exc.getCatchType();
String name = "finally";
if (type != 0) {
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/FieldOrMethod.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/FieldOrMethod.java
index a152b616f..8689e31b9 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/FieldOrMethod.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/FieldOrMethod.java
@@ -168,8 +168,7 @@ public abstract class FieldOrMethod extends Modifiers implements Node {
if (annotations == null) {
// Find attributes that contain annotation data
List<AnnotationGen> accumulatedAnnotations = new ArrayList<AnnotationGen>();
- for (int i = 0; i < attributes.length; i++) {
- Attribute attribute = attributes[i];
+ for (Attribute attribute : attributes) {
if (attribute instanceof RuntimeAnnos) {
RuntimeAnnos runtimeAnnotations = (RuntimeAnnos) attribute;
accumulatedAnnotations.addAll(runtimeAnnotations.getAnnotations());
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java
index 25c415295..59c092239 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java
@@ -260,18 +260,18 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
file.writeShort(superclassnameIdx);
file.writeShort(interfaces.length);
- for (int i = 0; i < interfaces.length; i++) {
- file.writeShort(interfaces[i]);
+ for (int anInterface : interfaces) {
+ file.writeShort(anInterface);
}
file.writeShort(fields.length);
- for (int i = 0; i < fields.length; i++) {
- fields[i].dump(file);
+ for (Field field : fields) {
+ field.dump(file);
}
file.writeShort(methods.length);
- for (int i = 0; i < methods.length; i++) {
- methods[i].dump(file);
+ for (Method method : methods) {
+ method.dump(file);
}
AttributeUtils.writeAttributes(attributes, file);
@@ -287,8 +287,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
if (annotationsOutOfDate) {
// Find attributes that contain annotation data
List<AnnotationGen> accumulatedAnnotations = new ArrayList<AnnotationGen>();
- for (int i = 0; i < attributes.length; i++) {
- Attribute attribute = attributes[i];
+ for (Attribute attribute : attributes) {
if (attribute instanceof RuntimeAnnos) {
RuntimeAnnos runtimeAnnotations = (RuntimeAnnos) attribute;
accumulatedAnnotations.addAll(runtimeAnnotations.getAnnotations());
@@ -366,9 +365,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
* @return A org.aspectj.apache.bcel.classfile.Method corresponding to java.lang.reflect.Method if any
*/
public Method getMethod(java.lang.reflect.Method m) {
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
-
+ for (Method method : methods) {
if (m.getName().equals(method.getName()) && m.getModifiers() == method.getModifiers()
&& Type.getSignature(m).equals(method.getSignature())) {
return method;
@@ -379,8 +376,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
}
public Method getMethod(java.lang.reflect.Constructor<?> c) {
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
+ for (Method method : methods) {
if (method.getName().equals("<init>") && c.getModifiers() == method.getModifiers()
&& Type.getSignature(c).equals(method.getSignature())) {
return method;
@@ -552,29 +548,29 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
if (attributes.length > 0) {
buf.append("\nAttribute(s):\n");
- for (int i = 0; i < attributes.length; i++) {
- buf.append(indent(attributes[i]));
+ for (Attribute attribute : attributes) {
+ buf.append(indent(attribute));
}
}
if (annotations != null && annotations.length > 0) {
buf.append("\nAnnotation(s):\n");
- for (int i = 0; i < annotations.length; i++) {
- buf.append(indent(annotations[i]));
+ for (AnnotationGen annotation : annotations) {
+ buf.append(indent(annotation));
}
}
if (fields.length > 0) {
buf.append("\n" + fields.length + " fields:\n");
- for (int i = 0; i < fields.length; i++) {
- buf.append("\t" + fields[i] + '\n');
+ for (Field field : fields) {
+ buf.append("\t" + field + '\n');
}
}
if (methods.length > 0) {
buf.append("\n" + methods.length + " methods:\n");
- for (int i = 0; i < methods.length; i++) {
- buf.append("\t" + methods[i] + '\n');
+ for (Method method : methods) {
+ buf.append("\t" + method + '\n');
}
}
@@ -615,12 +611,12 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
return;
}
// Attribute[] attrs = attributes.getAttributes();
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i] instanceof InnerClasses) {
- InnerClass[] innerClasses = ((InnerClasses) attributes[i]).getInnerClasses();
- for (int j = 0; j < innerClasses.length; j++) {
+ for (Attribute attribute : attributes) {
+ if (attribute instanceof InnerClasses) {
+ InnerClass[] innerClasses = ((InnerClasses) attribute).getInnerClasses();
+ for (InnerClass innerClass : innerClasses) {
boolean innerClassAttributeRefersToMe = false;
- String inner_class_name = cpool.getConstantString(innerClasses[j].getInnerClassIndex(),
+ String inner_class_name = cpool.getConstantString(innerClass.getInnerClassIndex(),
Constants.CONSTANT_Class);
inner_class_name = Utility.compactClassName(inner_class_name);
if (inner_class_name.equals(getClassName())) {
@@ -628,7 +624,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
}
if (innerClassAttributeRefersToMe) {
this.isNested = true;
- if (innerClasses[j].getInnerNameIndex() == 0) {
+ if (innerClass.getInnerNameIndex() == 0) {
this.isAnonymous = true;
}
}
@@ -684,8 +680,8 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
JavaClass[] super_classes = getSuperClasses();
- for (int i = 0; i < super_classes.length; i++) {
- if (super_classes[i].equals(super_class)) {
+ for (JavaClass superClass : super_classes) {
+ if (superClass.equals(super_class)) {
return true;
}
}
@@ -795,8 +791,8 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
}
}
- for (int i = 0; i < interfaces.length; i++) {
- queue.add(interfaces[i]);
+ for (JavaClass anInterface : interfaces) {
+ queue.add(anInterface);
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java
index 46aeac845..baa0629c6 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java
@@ -165,11 +165,10 @@ public final class Method extends FieldOrMethod {
signature = Utility.methodSignatureToString(signature, name, access, true, getLocalVariableTable());
buf = new StringBuffer(signature);
- for (int i = 0; i < attributes.length; i++) {
- Attribute a = attributes[i];
- if (!((a instanceof Code) || (a instanceof ExceptionTable)))
- buf.append(" [" + a.toString() + "]");
- }
+ for (Attribute a : attributes) {
+ if (!((a instanceof Code) || (a instanceof ExceptionTable)))
+ buf.append(" [" + a.toString() + "]");
+ }
ExceptionTable e = getExceptionTable();
if (e != null) {
@@ -212,14 +211,14 @@ public final class Method extends FieldOrMethod {
// Find attributes that contain annotation data
Attribute[] attrs = getAttributes();
- for (int i = 0; i < attrs.length; i++) {
- Attribute attribute = attrs[i];
- if (attribute instanceof RuntimeVisParamAnnos) {
- parameterAnnotationsVis = (RuntimeVisParamAnnos) attribute;
- } else if (attribute instanceof RuntimeInvisParamAnnos) {
- parameterAnnotationsInvis = (RuntimeInvisParamAnnos) attribute;
- }
- }
+ for (Attribute attribute : attrs) {
+ if (attribute instanceof RuntimeVisParamAnnos) {
+ parameterAnnotationsVis = (RuntimeVisParamAnnos) attribute;
+ }
+ else if (attribute instanceof RuntimeInvisParamAnnos) {
+ parameterAnnotationsInvis = (RuntimeInvisParamAnnos) attribute;
+ }
+ }
boolean foundSome = false;
// Build a list of annotation arrays, one per argument
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Module.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Module.java
index 5eef18cde..1302aeede 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Module.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Module.java
@@ -438,10 +438,10 @@ public final class Module extends Attribute {
file.writeShort(moduleVersionIndex);
file.writeShort(requires.length);
- for (int i = 0; i < requires.length; i++) {
- file.writeShort(requires[i].moduleIndex);
- file.writeShort(requires[i].flags);
- file.writeShort(requires[i].versionIndex);
+ for (Require require : requires) {
+ file.writeShort(require.moduleIndex);
+ file.writeShort(require.flags);
+ file.writeShort(require.versionIndex);
}
file.writeShort(exports.length);
for (Export export : exports) {
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ModulePackages.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ModulePackages.java
index 37da4bc47..6f96ae0fd 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ModulePackages.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ModulePackages.java
@@ -97,8 +97,8 @@ public final class ModulePackages extends Attribute {
public final void dump(DataOutputStream stream) throws IOException {
super.dump(stream);
stream.writeShort(packageIndices.length);
- for (int i = 0; i < packageIndices.length; i++) {
- stream.writeShort(packageIndices[i]);
+ for (int packageIndex : packageIndices) {
+ stream.writeShort(packageIndex);
}
}
@@ -117,8 +117,8 @@ public final class ModulePackages extends Attribute {
@Override
public final String toString() {
StringBuffer buf = new StringBuffer();
- for (int i = 0; i < packageIndices.length; i++) {
- buf.append(cpool.getPackageName(packageIndices[i]) + "\n");
+ for (int packageIndex : packageIndices) {
+ buf.append(cpool.getPackageName(packageIndex) + "\n");
}
return buf.toString();
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java
index 98f5952ae..2d4b2a81f 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java
@@ -522,26 +522,26 @@ public abstract class Utility {
char[] ch = label.toCharArray();
StringBuffer buf = new StringBuffer();
- for (int i = 0; i < ch.length; i++) {
- switch (ch[i]) {
- case '\n':
- buf.append("\\n");
- break;
- case '\r':
- buf.append("\\r");
- break;
- case '\"':
- buf.append("\\\"");
- break;
- case '\'':
- buf.append("\\'");
- break;
- case '\\':
- buf.append("\\\\");
- break;
- default:
- buf.append(ch[i]);
- break;
+ for (char c : ch) {
+ switch (c) {
+ case '\n':
+ buf.append("\\n");
+ break;
+ case '\r':
+ buf.append("\\r");
+ break;
+ case '\"':
+ buf.append("\\\"");
+ break;
+ case '\'':
+ buf.append("\\'");
+ break;
+ case '\\':
+ buf.append("\\\\");
+ break;
+ default:
+ buf.append(c);
+ break;
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java
index 9a0a42909..8074e383e 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java
@@ -82,8 +82,7 @@ public class AnnotationGen {
public void dump(DataOutputStream dos) throws IOException {
dos.writeShort(typeIndex); // u2 index of type name in cpool
dos.writeShort(pairs.size()); // u2 element_value pair count
- for (int i = 0; i < pairs.size(); i++) {
- NameValuePair envp = pairs.get(i);
+ for (NameValuePair envp : pairs) {
envp.dump(dos);
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java
index 3dd19af71..4cb5f5fe8 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java
@@ -55,8 +55,8 @@ public class ArrayElementValue extends ElementValue {
public void dump(DataOutputStream dos) throws IOException {
dos.writeByte(type); // u1 type of value (ARRAY == '[')
dos.writeShort(evalues.length);
- for (int i = 0; i < evalues.length; i++) {
- evalues[i].dump(dos);
+ for (ElementValue evalue : evalues) {
+ evalue.dump(dos);
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java
index ac145087b..ecb1d539d 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java
@@ -64,8 +64,7 @@ public abstract class RuntimeAnnos extends Attribute {
dos.write(annotation_data, 0, length);
} else {
dos.writeShort(annotations.size());
- for (Iterator<AnnotationGen> i = annotations.iterator(); i.hasNext();) {
- AnnotationGen ann = i.next();
+ for (AnnotationGen ann : annotations) {
ann.dump(dos);
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java
index 517ebee62..42bf903a1 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java
@@ -115,11 +115,10 @@ public abstract class RuntimeParamAnnos extends Attribute {
dos.write(annotation_data,0,length);
} else {
dos.writeByte(parameterAnnotations.size());
- for (int i=0; i<parameterAnnotations.size(); i++) {
- AnnotationGen[] annotations = parameterAnnotations.get(i);
+ for (AnnotationGen[] annotations : parameterAnnotations) {
dos.writeShort(annotations.length);
- for (int j=0; j<annotations.length;j++) {
- annotations[j].dump(dos);
+ for (AnnotationGen annotation : annotations) {
+ annotation.dump(dos);
}
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeTypeAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeTypeAnnos.java
index fb5c32ce1..4e4fae650 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeTypeAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeTypeAnnos.java
@@ -47,8 +47,8 @@ public abstract class RuntimeTypeAnnos extends Attribute {
dos.write(annotation_data,0,length);
} else {
dos.writeShort(typeAnnotations.length);
- for (int i=0; i<typeAnnotations.length; i++) {
- typeAnnotations[i].dump(dos);
+ for (TypeAnnotationGen typeAnnotation : typeAnnotations) {
+ typeAnnotation.dump(dos);
}
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/TypeAnnotationGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/TypeAnnotationGen.java
index 45e5928a3..ad7544eba 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/TypeAnnotationGen.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/TypeAnnotationGen.java
@@ -182,8 +182,8 @@ public class TypeAnnotationGen {
case LOCAL_VARIABLE:
case RESOURCE_VARIABLE:
dos.writeShort(localVarTarget.length/3);
- for (int i=0;i<localVarTarget.length;i++) {
- dos.writeShort(localVarTarget[i]);
+ for (int j : localVarTarget) {
+ dos.writeShort(j);
}
break;
case EXCEPTION_PARAMETER:
@@ -208,8 +208,8 @@ public class TypeAnnotationGen {
throw new IllegalStateException("nyi "+targetType);
}
dos.writeByte(typePath.length);
- for (int i=0;i<typePath.length;i++) {
- dos.writeByte(typePath[i]);
+ for (int j : typePath) {
+ dos.writeByte(j);
}
annotation.dump(dos);
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java
index 4ba767d97..8b7f0dd3f 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java
@@ -141,8 +141,8 @@ public class ClassGen extends Modifiers implements Cloneable {
Field[] fields = clazz.getFields();
String[] interfaces = clazz.getInterfaceNames();
- for (int i = 0; i < interfaces.length; i++) {
- addInterface(interfaces[i]);
+ for (String anInterface : interfaces) {
+ addInterface(anInterface);
}
// OPTIMIZE Could make unpacking lazy, done on first reference
@@ -165,12 +165,12 @@ public class ClassGen extends Modifiers implements Cloneable {
}
}
- for (int i = 0; i < methods.length; i++) {
- addMethod(methods[i]);
+ for (Method method : methods) {
+ addMethod(method);
}
- for (int i = 0; i < fields.length; i++) {
- addField(fields[i]);
+ for (Field field : fields) {
+ addField(field);
}
}
@@ -367,14 +367,12 @@ public class ClassGen extends Modifiers implements Cloneable {
public void setMethods(Method[] methods) {
methodsList.clear();
- for (int m = 0; m < methods.length; m++)
- addMethod(methods[m]);
+ for (Method method : methods) addMethod(method);
}
public void setFields(Field[] fs) {
fieldsList.clear();
- for (int m = 0; m < fs.length; m++)
- addField(fs[m]);
+ for (Field f : fs) addField(f);
}
public void setMethodAt(Method method, int pos) {
@@ -498,8 +496,7 @@ public class ClassGen extends Modifiers implements Cloneable {
String[] names = getInterfaceNames();
if (names != null) {
Arrays.sort(names);
- for (int i = 0; i < names.length; i++)
- dos.writeUTF(names[i]);
+ for (String name : names) dos.writeUTF(name);
}
// 4. ordered list of fields (ignoring private static and private transient fields):
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java
index 6a12a8c80..50b9ac496 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java
@@ -111,18 +111,17 @@ public class FieldGen extends FieldGenOrMethodGen {
Attribute[] attrs = field.getAttributes();
- for (int i = 0; i < attrs.length; i++) {
- if (attrs[i] instanceof ConstantValue) {
- setValue(((ConstantValue) attrs[i]).getConstantValueIndex());
- } else if (attrs[i] instanceof RuntimeAnnos) {
- RuntimeAnnos runtimeAnnotations = (RuntimeAnnos) attrs[i];
+ for (Attribute attr : attrs) {
+ if (attr instanceof ConstantValue) {
+ setValue(((ConstantValue) attr).getConstantValueIndex());
+ } else if (attr instanceof RuntimeAnnos) {
+ RuntimeAnnos runtimeAnnotations = (RuntimeAnnos) attr;
List<AnnotationGen> l = runtimeAnnotations.getAnnotations();
- for (Iterator<AnnotationGen> it = l.iterator(); it.hasNext();) {
- AnnotationGen element = it.next();
+ for (AnnotationGen element : l) {
addAnnotation(new AnnotationGen(element, cp, false));
}
} else {
- addAttribute(attrs[i]);
+ addAttribute(attr);
}
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionFactory.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionFactory.java
index 4e1e6c8a8..a3b1fb30e 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionFactory.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionFactory.java
@@ -119,8 +119,8 @@ public class InstructionFactory implements InstructionConstants {
return new InvokeInstruction(Constants.INVOKESTATIC, index);
case Constants.INVOKEINTERFACE:
int nargs = 0;
- for (int i = 0; i < arg_types.length; i++) {
- nargs += arg_types[i].getSize();
+ for (Type arg_type : arg_types) {
+ nargs += arg_type.getSize();
}
return new INVOKEINTERFACE(index, nargs + 1, 0);
default:
@@ -148,8 +148,8 @@ public class InstructionFactory implements InstructionConstants {
case Constants.INVOKEINTERFACE:
Type[] argumentTypes = Type.getArgumentTypes(signature);
int nargs = 0;
- for (int i = 0; i < argumentTypes.length; i++) {// Count size of arguments
- nargs += argumentTypes[i].getSize();
+ for (Type argumentType : argumentTypes) {// Count size of arguments
+ nargs += argumentType.getSize();
}
return new INVOKEINTERFACE(index, nargs + 1, 0);
default:
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java
index b08a2b77c..dbdfb7fdb 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java
@@ -953,8 +953,8 @@ public class InstructionList implements Serializable {
if (i instanceof InstructionSelect) {
InstructionHandle[] targets = ((InstructionSelect) i).getTargets();
- for (int j = 0; j < targets.length; j++) {
- inst = targets[j].instruction;
+ for (InstructionHandle target : targets) {
+ inst = target.instruction;
if (!contains(inst)) {
throw new ClassGenException("Branch target of " + Constants.OPCODE_NAMES[i.opcode] + ":" + inst
+ " not in instruction list");
@@ -1247,15 +1247,15 @@ public class InstructionList implements Serializable {
* @see MethodGen
*/
public void redirectLocalVariables(LocalVariableGen[] lg, InstructionHandle old_target, InstructionHandle new_target) {
- for (int i = 0; i < lg.length; i++) {
- InstructionHandle start = lg[i].getStart();
- InstructionHandle end = lg[i].getEnd();
+ for (LocalVariableGen localVariableGen : lg) {
+ InstructionHandle start = localVariableGen.getStart();
+ InstructionHandle end = localVariableGen.getEnd();
if (start == old_target) {
- lg[i].setStart(new_target);
+ localVariableGen.setStart(new_target);
}
if (end == old_target) {
- lg[i].setEnd(new_target);
+ localVariableGen.setEnd(new_target);
}
}
}
@@ -1269,17 +1269,17 @@ public class InstructionList implements Serializable {
* @see MethodGen
*/
public void redirectExceptionHandlers(CodeExceptionGen[] exceptions, InstructionHandle old_target, InstructionHandle new_target) {
- for (int i = 0; i < exceptions.length; i++) {
- if (exceptions[i].getStartPC() == old_target) {
- exceptions[i].setStartPC(new_target);
+ for (CodeExceptionGen exception : exceptions) {
+ if (exception.getStartPC() == old_target) {
+ exception.setStartPC(new_target);
}
- if (exceptions[i].getEndPC() == old_target) {
- exceptions[i].setEndPC(new_target);
+ if (exception.getEndPC() == old_target) {
+ exception.setEndPC(new_target);
}
- if (exceptions[i].getHandlerPC() == old_target) {
- exceptions[i].setHandlerPC(new_target);
+ if (exception.getHandlerPC() == old_target) {
+ exception.setHandlerPC(new_target);
}
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionSelect.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionSelect.java
index b4e00c027..408f801ff 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionSelect.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionSelect.java
@@ -88,8 +88,8 @@ public abstract class InstructionSelect extends InstructionBranch {
super(opcode, target);
this.targets = targets;
- for (int i = 0; i < targets.length; i++) {
- notifyTarget(null, targets[i], this);
+ for (InstructionHandle instructionHandle : targets) {
+ notifyTarget(null, instructionHandle, this);
}
this.match = match;
@@ -236,8 +236,8 @@ public abstract class InstructionSelect extends InstructionBranch {
return true;
}
- for (int i = 0; i < targets.length; i++) {
- if (targets[i] == ih) {
+ for (InstructionHandle target : targets) {
+ if (target == ih) {
return true;
}
}
@@ -251,8 +251,8 @@ public abstract class InstructionSelect extends InstructionBranch {
void dispose() {
super.dispose();
- for (int i = 0; i < targets.length; i++) {
- targets[i].removeTargeter(this);
+ for (InstructionHandle target : targets) {
+ target.removeTargeter(this);
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java
index 3938beb35..46b558146 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java
@@ -212,8 +212,8 @@ public class MethodGen extends FieldGenOrMethodGen {
.getCode()) : null, cp);
Attribute[] attributes = m.getAttributes();
- for (int i = 0; i < attributes.length; i++) {
- Attribute a = attributes[i];
+ for (Attribute attribute : attributes) {
+ Attribute a = attribute;
if (a instanceof Code) {
Code code = (Code) a;
@@ -254,15 +254,14 @@ public class MethodGen extends FieldGenOrMethodGen {
}
Attribute[] codeAttrs = code.getAttributes();
- for (int j = 0; j < codeAttrs.length; j++) {
- a = codeAttrs[j];
+ for (Attribute codeAttr : codeAttrs) {
+ a = codeAttr;
if (a instanceof LineNumberTable) {
LineNumber[] ln = ((LineNumberTable) a).getLineNumberTable();
if (useTags) {
// abracadabra, lets create tags rather than linenumbergens.
- for (int k = 0; k < ln.length; k++) {
- LineNumber l = ln[k];
+ for (LineNumber l : ln) {
int lnum = l.getLineNumber();
if (lnum > highestLineNumber) {
highestLineNumber = lnum;
@@ -271,8 +270,7 @@ public class MethodGen extends FieldGenOrMethodGen {
il.findHandle(l.getStartPC(), arrayOfInstructions, true).addTargeter(lt);
}
} else {
- for (int k = 0; k < ln.length; k++) {
- LineNumber l = ln[k];
+ for (LineNumber l : ln) {
addLineNumber(il.findHandle(l.getStartPC(), arrayOfInstructions, true), l.getLineNumber());
}
}
@@ -282,8 +280,7 @@ public class MethodGen extends FieldGenOrMethodGen {
if (useTags) {
LocalVariable[] lv = ((LocalVariableTable) a).getLocalVariableTable();
- for (int k = 0; k < lv.length; k++) {
- LocalVariable l = lv[k];
+ for (LocalVariable l : lv) {
Type t = Type.getType(l.getSignature());
LocalVariableTag lvt = new LocalVariableTag(t, l.getSignature(), l.getName(), l.getIndex(), l
.getStartPC());
@@ -307,8 +304,7 @@ public class MethodGen extends FieldGenOrMethodGen {
removeLocalVariables();
- for (int k = 0; k < lv.length; k++) {
- LocalVariable l = lv[k];
+ for (LocalVariable l : lv) {
InstructionHandle start = il.findHandle(l.getStartPC(), arrayOfInstructions);
InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength(), arrayOfInstructions);
// AMC, this actually gives us the first instruction AFTER the range,
@@ -333,8 +329,8 @@ public class MethodGen extends FieldGenOrMethodGen {
}
} else if (a instanceof ExceptionTable) {
String[] names = ((ExceptionTable) a).getExceptionNames();
- for (int j = 0; j < names.length; j++) {
- addException(names[j]);
+ for (String s : names) {
+ addException(s);
}
} else if (a instanceof RuntimeAnnos) {
RuntimeAnnos runtimeAnnotations = (RuntimeAnnos) a;
@@ -647,8 +643,8 @@ public class MethodGen extends FieldGenOrMethodGen {
}
Attribute[] attrs = Utility.getParameterAnnotationAttributes(cp, param_annotations);
if (attrs != null) {
- for (int i = 0; i < attrs.length; i++) {
- addAttribute(attrs[i]);
+ for (Attribute attr : attrs) {
+ addAttribute(attr);
}
}
}
@@ -722,8 +718,8 @@ public class MethodGen extends FieldGenOrMethodGen {
* Each attribute causes 6 additional header bytes
*/
int attrs_len = 0;
- for (int i = 0; i < code_attrs.length; i++) {
- attrs_len += (code_attrs[i].getLength() + 6);
+ for (Attribute code_attr : code_attrs) {
+ attrs_len += (code_attr.getLength() + 6);
}
CodeException[] c_exc = getCodeExceptions();
@@ -734,8 +730,7 @@ public class MethodGen extends FieldGenOrMethodGen {
if ((il != null) && !isAbstract()) {
// Remove any stale code attribute
List<Attribute> attributes = getAttributes();
- for (int i = 0; i < attributes.size(); i++) {
- Attribute a = attributes.get(i);
+ for (Attribute a : attributes) {
if (a instanceof Code) {
removeAttribute(a);
}
@@ -897,8 +892,8 @@ public class MethodGen extends FieldGenOrMethodGen {
int max = isStatic() ? 0 : 1;
if (parameterTypes != null) {
- for (int i = 0; i < parameterTypes.length; i++) {
- max += parameterTypes[i].getSize();
+ for (Type parameterType : parameterTypes) {
+ max += parameterType.getSize();
}
}
@@ -985,8 +980,8 @@ public class MethodGen extends FieldGenOrMethodGen {
* Initially, populate the branch stack with the exception handlers, because these aren't (necessarily) branched to
* explicitly. In each case, the stack will have depth 1, containing the exception object.
*/
- for (int i = 0, max = et.length; i < max; i++) {
- InstructionHandle handlerPos = et[i].getHandlerPC();
+ for (CodeExceptionGen codeExceptionGen : et) {
+ InstructionHandle handlerPos = codeExceptionGen.getHandlerPC();
if (handlerPos != null) {
// it must be at least 1 since there is an exception handler
maxStackDepth = 1;
@@ -1014,8 +1009,8 @@ public class MethodGen extends FieldGenOrMethodGen {
// explore all of the select's targets. the default target is handled below.
InstructionSelect select = (InstructionSelect) branch;
InstructionHandle[] targets = select.getTargets();
- for (int i = 0; i < targets.length; i++) {
- branchTargets.push(targets[i], stackDepth);
+ for (InstructionHandle target : targets) {
+ branchTargets.push(target, stackDepth);
}
// nothing to fall through to.
ih = null;
@@ -1069,8 +1064,8 @@ public class MethodGen extends FieldGenOrMethodGen {
StringBuffer buf = new StringBuffer(signature);
if (exceptionsThrown.size() > 0) {
- for (Iterator<String> e = exceptionsThrown.iterator(); e.hasNext();) {
- buf.append("\n\t\tthrows " + e.next());
+ for (String s : exceptionsThrown) {
+ buf.append("\n\t\tthrows " + s);
}
}
@@ -1145,8 +1140,8 @@ public class MethodGen extends FieldGenOrMethodGen {
private List /* AnnotationGen */<AnnotationGen> makeMutableVersion(AnnotationGen[] mutableArray) {
List<AnnotationGen> result = new ArrayList<AnnotationGen>();
- for (int i = 0; i < mutableArray.length; i++) {
- result.add(new AnnotationGen(mutableArray[i], getConstantPool(), false));
+ for (AnnotationGen annotationGen : mutableArray) {
+ result.add(new AnnotationGen(annotationGen, getConstantPool(), false));
}
return result;
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ReferenceType.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ReferenceType.java
index 1e290f5a4..f29569cb5 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ReferenceType.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ReferenceType.java
@@ -280,10 +280,10 @@ public abstract class ReferenceType extends Type {
this_sups[0] = Repository.lookupClass(thiz.getClassName());
t_sups[0] = Repository.lookupClass(other.getClassName());
- for (int i = 0; i < t_sups.length; i++) {
- for (int j = 0; j < this_sups.length; j++) {
- if (this_sups[j].equals(t_sups[i])) {
- return new ObjectType(this_sups[j].getClassName());
+ for (JavaClass t_sup : t_sups) {
+ for (JavaClass this_sup : this_sups) {
+ if (this_sup.equals(t_sup)) {
+ return new ObjectType(this_sup.getClassName());
}
}
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Type.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Type.java
index 9ce007b4f..68b68f3d6 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Type.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Type.java
@@ -466,8 +466,8 @@ public abstract class Type {
StringBuffer sb = new StringBuffer("(");
Class[] params = meth.getParameterTypes(); // avoid clone
- for (int j = 0; j < params.length; j++) {
- sb.append(getType(params[j]).getSignature());
+ for (Class param : params) {
+ sb.append(getType(param).getSignature());
}
sb.append(")");
@@ -479,8 +479,8 @@ public abstract class Type {
StringBuffer sb = new StringBuffer("(");
Class<?>[] params = cons.getParameterTypes(); // avoid clone
- for (int j = 0; j < params.length; j++) {
- sb.append(getType(params[j]).getSignature());
+ for (Class<?> param : params) {
+ sb.append(getType(param).getSignature());
}
sb.append(")V");
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/NonCachingClassLoaderRepository.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/NonCachingClassLoaderRepository.java
index a53b9dc35..fe43a7bef 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/NonCachingClassLoaderRepository.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/NonCachingClassLoaderRepository.java
@@ -148,8 +148,7 @@ public class NonCachingClassLoaderRepository implements Repository {
public void clear() {
processQueue();
Set<Object> keys = map.keySet();
- for (Iterator<Object> iterator = keys.iterator(); iterator.hasNext();) {
- Object name = iterator.next();
+ for (Object name : keys) {
map.remove(name);
}
}