You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2013/12/31 23:05:02 UTC
svn commit: r1554576 [1/2] - in /commons/proper/bcel/trunk/src:
main/java/org/apache/bcel/classfile/ main/java/org/apache/bcel/generic/
main/java/org/apache/bcel/util/ main/java/org/apache/bcel/verifier/
main/java/org/apache/bcel/verifier/statics/ main...
Author: ggregory
Date: Tue Dec 31 22:05:01 2013
New Revision: 1554576
URL: http://svn.apache.org/r1554576
Log:
Java 5: Convert 'for' loops to enhanced 'for' loops.
Modified:
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Annotations.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/DescendingVisitor.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/FieldOrMethod.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/JavaClass.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotations.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayElementValueGen.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassGen.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGen.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReferenceType.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Select.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELifier.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassPath.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/CodeHTML.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/MethodHTML.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/Verifier.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifyDialog.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/IntList.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/ControlFlowGraph.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/ExceptionHandlers.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java
commons/proper/bcel/trunk/src/test/java/org/apache/bcel/AbstractTestCase.java
commons/proper/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java
commons/proper/bcel/trunk/src/test/java/org/apache/bcel/FieldAnnotationsTestCase.java
commons/proper/bcel/trunk/src/test/java/org/apache/bcel/GeneratingAnnotatedClassesTestCase.java
commons/proper/bcel/trunk/src/test/java/org/apache/bcel/PerformanceTest.java
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Annotations.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Annotations.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Annotations.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Annotations.java Tue Dec 31 22:05:01 2013
@@ -108,8 +108,8 @@ public abstract class Annotations extend
return;
}
dos.writeShort(annotation_table.length);
- for (int i = 0; i < annotation_table.length; i++) {
- annotation_table[i].dump(dos);
+ for (AnnotationEntry element : annotation_table) {
+ element.dump(dos);
}
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java Tue Dec 31 22:05:01 2013
@@ -54,9 +54,8 @@ public class ArrayElementValue extends E
{
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);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/DescendingVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/DescendingVisitor.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/DescendingVisitor.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/DescendingVisitor.java Tue Dec 31 22:05:01 2013
@@ -94,19 +94,16 @@ public class DescendingVisitor implement
stack.push(_clazz);
_clazz.accept(visitor);
Field[] fields = _clazz.getFields();
- for (int i = 0; i < fields.length; i++)
- {
- fields[i].accept(this);
+ for (Field field : fields) {
+ field.accept(this);
}
Method[] methods = _clazz.getMethods();
- for (int i = 0; i < methods.length; i++)
- {
- methods[i].accept(this);
+ for (Method method : methods) {
+ method.accept(this);
}
Attribute[] attributes = _clazz.getAttributes();
- for (int i = 0; i < attributes.length; i++)
- {
- attributes[i].accept(this);
+ for (Attribute attribute : attributes) {
+ attribute.accept(this);
}
_clazz.getConstantPool().accept(this);
stack.pop();
@@ -117,9 +114,8 @@ public class DescendingVisitor implement
stack.push(annotation);
annotation.accept(visitor);
AnnotationEntry[] entries = annotation.getAnnotationEntries();
- for (int i = 0; i < entries.length; i++)
- {
- entries[i].accept(this);
+ for (AnnotationEntry entrie : entries) {
+ entrie.accept(this);
}
stack.pop();
}
@@ -136,9 +132,8 @@ public class DescendingVisitor implement
stack.push(field);
field.accept(visitor);
Attribute[] attributes = field.getAttributes();
- for (int i = 0; i < attributes.length; i++)
- {
- attributes[i].accept(this);
+ for (Attribute attribute : attributes) {
+ attribute.accept(this);
}
stack.pop();
}
@@ -155,9 +150,8 @@ public class DescendingVisitor implement
stack.push(method);
method.accept(visitor);
Attribute[] attributes = method.getAttributes();
- for (int i = 0; i < attributes.length; i++)
- {
- attributes[i].accept(this);
+ for (Attribute attribute : attributes) {
+ attribute.accept(this);
}
stack.pop();
}
@@ -174,14 +168,12 @@ public class DescendingVisitor implement
stack.push(code);
code.accept(visitor);
CodeException[] table = code.getExceptionTable();
- for (int i = 0; i < table.length; i++)
- {
- table[i].accept(this);
+ for (CodeException element : table) {
+ element.accept(this);
}
Attribute[] attributes = code.getAttributes();
- for (int i = 0; i < attributes.length; i++)
- {
- attributes[i].accept(this);
+ for (Attribute attribute : attributes) {
+ attribute.accept(this);
}
stack.pop();
}
@@ -198,9 +190,8 @@ public class DescendingVisitor implement
stack.push(table);
table.accept(visitor);
LineNumber[] numbers = table.getLineNumberTable();
- for (int i = 0; i < numbers.length; i++)
- {
- numbers[i].accept(this);
+ for (LineNumber number : numbers) {
+ number.accept(this);
}
stack.pop();
}
@@ -217,9 +208,8 @@ public class DescendingVisitor implement
stack.push(table);
table.accept(visitor);
LocalVariable[] vars = table.getLocalVariableTable();
- for (int i = 0; i < vars.length; i++)
- {
- vars[i].accept(this);
+ for (LocalVariable var : vars) {
+ var.accept(this);
}
stack.pop();
}
@@ -229,9 +219,8 @@ public class DescendingVisitor implement
stack.push(table);
table.accept(visitor);
StackMapEntry[] vars = table.getStackMap();
- for (int i = 0; i < vars.length; i++)
- {
- vars[i].accept(this);
+ for (StackMapEntry var : vars) {
+ var.accept(this);
}
stack.pop();
}
@@ -248,9 +237,8 @@ public class DescendingVisitor implement
stack.push(table);
table.accept(visitor);
StackMapTableEntry[] vars = table.getStackMapTable();
- for (int i = 0; i < vars.length; i++)
- {
- vars[i].accept(this);
+ for (StackMapTableEntry var : vars) {
+ var.accept(this);
}
stack.pop();
}
@@ -367,9 +355,8 @@ public class DescendingVisitor implement
stack.push(ic);
ic.accept(visitor);
InnerClass[] ics = ic.getInnerClasses();
- for (int i = 0; i < ics.length; i++)
- {
- ics[i].accept(this);
+ for (InnerClass ic2 : ics) {
+ ic2.accept(this);
}
stack.pop();
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/FieldOrMethod.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/FieldOrMethod.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/FieldOrMethod.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/FieldOrMethod.java Tue Dec 31 22:05:01 2013
@@ -231,9 +231,7 @@ public abstract class FieldOrMethod exte
// Find attributes that contain annotation data
Attribute[] attrs = getAttributes();
List<AnnotationEntry> accumulatedAnnotations = new ArrayList<AnnotationEntry>();
- for (int i = 0; i < attrs.length; i++)
- {
- Attribute attribute = attrs[i];
+ for (Attribute attribute : attrs) {
if (attribute instanceof Annotations)
{
Annotations annotations = (Annotations) attribute;
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/JavaClass.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/JavaClass.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/JavaClass.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/JavaClass.java Tue Dec 31 22:05:01 2013
@@ -147,9 +147,9 @@ public class JavaClass extends AccessFla
annotationsOutOfDate = true;
this.source = source;
// Get source file name if available
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i] instanceof SourceFile) {
- source_file_name = ((SourceFile) attributes[i]).getSourceFileName();
+ for (Attribute attribute : attributes) {
+ if (attribute instanceof SourceFile) {
+ source_file_name = ((SourceFile) attribute).getSourceFileName();
break;
}
}
@@ -307,21 +307,21 @@ public class JavaClass extends AccessFla
file.writeShort(class_name_index);
file.writeShort(superclass_name_index);
file.writeShort(interfaces.length);
- for (int i = 0; i < interfaces.length; i++) {
- file.writeShort(interfaces[i]);
+ for (int interface1 : interfaces) {
+ file.writeShort(interface1);
}
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);
}
if (attributes != null) {
file.writeShort(attributes.length);
- for (int i = 0; i < attributes.length; i++) {
- attributes[i].dump(file);
+ for (Attribute attribute : attributes) {
+ attribute.dump(file);
}
} else {
file.writeShort(0);
@@ -342,8 +342,7 @@ public class JavaClass extends AccessFla
// Find attributes that contain annotation data
Attribute[] attrs = getAttributes();
List<AnnotationEntry> accumulatedAnnotations = new ArrayList<AnnotationEntry>();
- for (int i = 0; i < attrs.length; i++) {
- Attribute attribute = attrs[i];
+ for (Attribute attribute : attrs) {
if (attribute instanceof Annotations) {
Annotations runtimeAnnotations = (Annotations)attribute;
for(int j = 0; j < runtimeAnnotations.getAnnotationEntries().length; j++)
@@ -442,8 +441,7 @@ public class JavaClass extends AccessFla
* 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;
@@ -644,26 +642,26 @@ public class JavaClass extends AccessFla
buf.append("ACC_SUPER flag\t\t").append(isSuper()).append("\n");
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));
}
}
AnnotationEntry[] annotations = getAnnotationEntries();
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 (AnnotationEntry annotation : annotations)
+ buf.append(indent(annotation));
}
if (fields.length > 0) {
buf.append("\n").append(fields.length).append(" fields:\n");
- for (int i = 0; i < fields.length; i++) {
- buf.append("\t").append(fields[i]).append('\n');
+ for (Field field : fields) {
+ buf.append("\t").append(field).append('\n');
}
}
if (methods.length > 0) {
buf.append("\n").append(methods.length).append(" methods:\n");
- for (int i = 0; i < methods.length; i++) {
- buf.append("\t").append(methods[i]).append('\n');
+ for (Method method : methods) {
+ buf.append("\t").append(method).append('\n');
}
}
return buf.toString();
@@ -729,12 +727,12 @@ public class JavaClass extends AccessFla
private final void computeNestedTypeStatus() {
if (computedNestedTypeStatus) return;
- for (int i = 0; i < this.attributes.length; i++) {
- if (this.attributes[i] instanceof InnerClasses) {
- InnerClass[] innerClasses = ((InnerClasses) this.attributes[i]).getInnerClasses();
- for (int j = 0; j < innerClasses.length; j++) {
+ for (Attribute attribute : this.attributes) {
+ if (attribute instanceof InnerClasses) {
+ InnerClass[] innerClasses = ((InnerClasses) attribute).getInnerClasses();
+ for (InnerClass innerClasse : innerClasses) {
boolean innerClassAttributeRefersToMe = false;
- String inner_class_name = constant_pool.getConstantString(innerClasses[j].getInnerClassIndex(),
+ String inner_class_name = constant_pool.getConstantString(innerClasse.getInnerClassIndex(),
Constants.CONSTANT_Class);
inner_class_name = Utility.compactClassName(inner_class_name);
if (inner_class_name.equals(getClassName())) {
@@ -742,7 +740,7 @@ public class JavaClass extends AccessFla
}
if (innerClassAttributeRefersToMe) {
this.isNested = true;
- if (innerClasses[j].getInnerNameIndex() == 0) {
+ if (innerClasse.getInnerNameIndex() == 0) {
this.isAnonymous = true;
}
}
@@ -790,8 +788,8 @@ public class JavaClass extends AccessFla
return true;
}
JavaClass[] super_classes = getSuperClasses();
- for (int i = 0; i < super_classes.length; i++) {
- if (super_classes[i].equals(super_class)) {
+ for (JavaClass super_classe : super_classes) {
+ if (super_classe.equals(super_class)) {
return true;
}
}
@@ -815,8 +813,8 @@ public class JavaClass extends AccessFla
return true;
}
JavaClass[] super_interfaces = getAllInterfaces();
- for (int i = 0; i < super_interfaces.length; i++) {
- if (super_interfaces[i].equals(inter)) {
+ for (JavaClass super_interface : super_interfaces) {
+ if (super_interface.equals(inter)) {
return true;
}
}
@@ -883,8 +881,8 @@ public class JavaClass extends AccessFla
queue.enqueue(souper);
}
}
- for (int i = 0; i < _interfaces.length; i++) {
- queue.enqueue(_interfaces[i]);
+ for (JavaClass _interface : _interfaces) {
+ queue.enqueue(_interface);
}
}
return allInterfaces.toArray(new JavaClass[allInterfaces.size()]);
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotations.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotations.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotations.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotations.java Tue Dec 31 22:05:01 2013
@@ -122,8 +122,8 @@ public abstract class ParameterAnnotatio
super.dump(dos);
dos.writeByte(parameter_annotation_table.length);
- for (int i = 0; i < parameter_annotation_table.length; i++) {
- parameter_annotation_table[i].dump(dos);
+ for (ParameterAnnotationEntry element : parameter_annotation_table) {
+ element.dump(dos);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java Tue Dec 31 22:05:01 2013
@@ -543,10 +543,10 @@ public abstract class Utility {
StringBuilder buf = new StringBuilder("(");
String str;
if (argv != null) {
- for (int i = 0; i < argv.length; i++) {
- str = getSignature(argv[i]);
+ for (String element : argv) {
+ str = getSignature(element);
if (str.endsWith("V")) {
- throw new ClassFormatException("Invalid type: " + argv[i]);
+ throw new ClassFormatException("Invalid type: " + element);
}
buf.append(str);
}
@@ -924,8 +924,8 @@ public abstract class Utility {
char[] chars = brackets.toCharArray();
int count = 0;
boolean open = false;
- for (int i = 0; i < chars.length; i++) {
- switch (chars[i]) {
+ for (char c : chars) {
+ switch (c) {
case '[':
if (open) {
throw new RuntimeException("Illegally nested brackets:" + brackets);
@@ -1199,8 +1199,8 @@ public abstract class Utility {
}
CharArrayWriter caw = new CharArrayWriter();
JavaWriter jw = new JavaWriter(caw);
- for (int i = 0; i < bytes.length; i++) {
- int in = bytes[i] & 0x000000ff; // Normalize to unsigned
+ for (byte b : bytes) {
+ int in = b & 0x000000ff; // Normalize to unsigned
jw.write(in);
}
return caw.toString();
@@ -1363,8 +1363,8 @@ public abstract class Utility {
public static final String convertString( String label ) {
char[] ch = label.toCharArray();
StringBuilder buf = new StringBuilder();
- for (int i = 0; i < ch.length; i++) {
- switch (ch[i]) {
+ for (char element : ch) {
+ switch (element) {
case '\n':
buf.append("\\n");
break;
@@ -1381,7 +1381,7 @@ public abstract class Utility {
buf.append("\\\\");
break;
default:
- buf.append(ch[i]);
+ buf.append(element);
break;
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayElementValueGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayElementValueGen.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayElementValueGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayElementValueGen.java Tue Dec 31 22:05:01 2013
@@ -45,9 +45,8 @@ public class ArrayElementValueGen extend
throw new RuntimeException(
"Only element values of type array can be built with this ctor - type specified: " + type);
this.evalues = new ArrayList<ElementValueGen>();
- for (int i = 0; i < datums.length; i++)
- {
- evalues.add(ElementValueGen.copy(datums[i], cpool, true));
+ for (ElementValue datum : datums) {
+ evalues.add(ElementValueGen.copy(datum, cpool, true));
}
}
@@ -76,9 +75,8 @@ public class ArrayElementValueGen extend
super(ARRAY, cpool);
evalues = new ArrayList<ElementValueGen>();
ElementValue[] in = value.getElementValuesArray();
- for (int i = 0; i < in.length; i++)
- {
- evalues.add(ElementValueGen.copy(in[i], cpool, copyPoolEntries));
+ for (ElementValue element : in) {
+ evalues.add(ElementValueGen.copy(element, cpool, copyPoolEntries));
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassGen.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassGen.java Tue Dec 31 22:05:01 2013
@@ -99,8 +99,8 @@ public class ClassGen extends AccessFlag
class_name_index = cp.addClass(class_name);
superclass_name_index = cp.addClass(super_class_name);
if (interfaces != null) {
- for (int i = 0; i < interfaces.length; i++) {
- addInterface(interfaces[i]);
+ for (String interface1 : interfaces) {
+ addInterface(interface1);
}
}
}
@@ -141,22 +141,22 @@ public class ClassGen extends AccessFlag
Method[] methods = clazz.getMethods();
Field[] fields = clazz.getFields();
String[] interfaces = clazz.getInterfaceNames();
- for (int i = 0; i < interfaces.length; i++) {
- addInterface(interfaces[i]);
+ for (String interface1 : interfaces) {
+ addInterface(interface1);
}
for (int i = 0; i < attributes.length; i++) {
if (!(attributes[i] instanceof Annotations)) {
addAttribute(attributes[i]);
}
}
- for(int i=0; i < annotations.length; i++) {
- addAnnotationEntry(annotations[i]);
+ for (AnnotationEntryGen annotation : annotations) {
+ addAnnotationEntry(annotation);
}
- 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);
}
}
@@ -166,16 +166,12 @@ public class ClassGen extends AccessFlag
private AnnotationEntryGen[] unpackAnnotations(Attribute[] attrs)
{
List<AnnotationEntryGen> annotationGenObjs = new ArrayList<AnnotationEntryGen>();
- for (int i = 0; i < attrs.length; i++)
- {
- Attribute attr = attrs[i];
+ for (Attribute attr : attrs) {
if (attr instanceof RuntimeVisibleAnnotations)
{
RuntimeVisibleAnnotations rva = (RuntimeVisibleAnnotations) attr;
AnnotationEntry[] annos = rva.getAnnotationEntries();
- for (int j = 0; j < annos.length; j++)
- {
- AnnotationEntry a = annos[j];
+ for (AnnotationEntry a : annos) {
annotationGenObjs.add(new AnnotationEntryGen(a,
getConstantPool(), false));
}
@@ -185,9 +181,7 @@ public class ClassGen extends AccessFlag
{
RuntimeInvisibleAnnotations ria = (RuntimeInvisibleAnnotations) attr;
AnnotationEntry[] annos = ria.getAnnotationEntries();
- for (int j = 0; j < annos.length; j++)
- {
- AnnotationEntry a = annos[j];
+ for (AnnotationEntry a : annos) {
annotationGenObjs.add(new AnnotationEntryGen(a,
getConstantPool(), false));
}
@@ -442,8 +436,8 @@ public class ClassGen extends AccessFlag
public void setMethods( Method[] methods ) {
method_vec.clear();
- for (int m = 0; m < methods.length; m++) {
- addMethod(methods[m]);
+ for (Method method : methods) {
+ addMethod(method);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGen.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGen.java Tue Dec 31 22:05:01 2013
@@ -88,18 +88,17 @@ public class FieldGen extends FieldGenOr
public FieldGen(Field field, ConstantPoolGen cp) {
this(field.getAccessFlags(), Type.getType(field.getSignature()), field.getName(), cp);
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 Annotations) {
- Annotations runtimeAnnotations = (Annotations)attrs[i];
+ for (Attribute attr : attrs) {
+ if (attr instanceof ConstantValue) {
+ setValue(((ConstantValue) attr).getConstantValueIndex());
+ } else if (attr instanceof Annotations) {
+ Annotations runtimeAnnotations = (Annotations)attr;
AnnotationEntry[] annotationEntries = runtimeAnnotations.getAnnotationEntries();
- for (int j = 0; j < annotationEntries.length; j++) {
- AnnotationEntry element = annotationEntries[j];
+ for (AnnotationEntry element : annotationEntries) {
addAnnotationEntry(new AnnotationEntryGen(element,cp,false));
}
} else {
- addAttribute(attrs[i]);
+ addAttribute(attr);
}
}
}
@@ -228,8 +227,8 @@ public class FieldGen extends FieldGenOr
private void addAnnotationsAsAttribute(ConstantPoolGen cp) {
Attribute[] attrs = Utility.getAnnotationAttributes(cp,annotation_vec);
- for (int i = 0; i < attrs.length; i++) {
- addAttribute(attrs[i]);
+ for (Attribute attr : attrs) {
+ addAttribute(attr);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java Tue Dec 31 22:05:01 2013
@@ -76,8 +76,8 @@ public class InstructionFactory implemen
int index;
int nargs = 0;
String signature = Type.getMethodSignature(ret_type, arg_types);
- for (int i = 0; i < arg_types.length; i++) {
- nargs += arg_types[i].getSize();
+ for (Type arg_type : arg_types) {
+ nargs += arg_type.getSize();
}
if (kind == Constants.INVOKEINTERFACE) {
index = cp.addInterfaceMethodref(class_name, name, signature);
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java Tue Dec 31 22:05:01 2013
@@ -872,8 +872,8 @@ public class InstructionList implements
}
if (i instanceof Select) {
InstructionHandle[] targets = ((Select) 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
@@ -1208,14 +1208,14 @@ public class InstructionList implements
*/
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 element : lg) {
+ InstructionHandle start = element.getStart();
+ InstructionHandle end = element.getEnd();
if (start == old_target) {
- lg[i].setStart(new_target);
+ element.setStart(new_target);
}
if (end == old_target) {
- lg[i].setEnd(new_target);
+ element.setEnd(new_target);
}
}
}
@@ -1231,15 +1231,15 @@ public class InstructionList implements
*/
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);
}
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java Tue Dec 31 22:05:01 2013
@@ -23,6 +23,7 @@ import java.util.Comparator;
import java.util.Hashtable;
import java.util.List;
import java.util.Stack;
+
import org.apache.bcel.Constants;
import org.apache.bcel.classfile.AnnotationEntry;
import org.apache.bcel.classfile.Annotations;
@@ -182,16 +183,15 @@ public class MethodGen extends FieldGenO
? new InstructionList(m.getCode().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 c = (Code) a;
setMaxStack(c.getMaxStack());
setMaxLocals(c.getMaxLocals());
CodeException[] ces = c.getExceptionTable();
if (ces != null) {
- for (int j = 0; j < ces.length; j++) {
- CodeException ce = ces[j];
+ for (CodeException ce : ces) {
int type = ce.getCatchType();
ObjectType c_type = null;
if (type > 0) {
@@ -213,12 +213,11 @@ public class MethodGen extends FieldGenO
}
}
Attribute[] c_attributes = c.getAttributes();
- for (int j = 0; j < c_attributes.length; j++) {
- a = c_attributes[j];
+ for (Attribute c_attribute : c_attributes) {
+ a = c_attribute;
if (a instanceof LineNumberTable) {
LineNumber[] ln = ((LineNumberTable) a).getLineNumberTable();
- for (int k = 0; k < ln.length; k++) {
- LineNumber l = ln[k];
+ for (LineNumber l : ln) {
InstructionHandle ih = il.findHandle(l.getStartPC());
if (ih != null) {
addLineNumber(ih, l.getLineNumber());
@@ -227,8 +226,7 @@ public class MethodGen extends FieldGenO
} else if (a instanceof LocalVariableTable) {
LocalVariable[] lv = ((LocalVariableTable) a).getLocalVariableTable();
removeLocalVariables();
- for (int k = 0; k < lv.length; k++) {
- LocalVariable l = lv[k];
+ for (LocalVariable l : lv) {
InstructionHandle start = il.findHandle(l.getStartPC());
InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength());
// Repair malformed handles
@@ -244,8 +242,7 @@ public class MethodGen extends FieldGenO
} else if (a instanceof LocalVariableTypeTable) {
LocalVariable[] lv = ((LocalVariableTypeTable) a).getLocalVariableTypeTable();
removeLocalVariables();
- for (int k = 0; k < lv.length; k++) {
- LocalVariable l = lv[k];
+ for (LocalVariable l : lv) {
InstructionHandle start = il.findHandle(l.getStartPC());
InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength());
// Repair malformed handles
@@ -264,14 +261,13 @@ public class MethodGen extends FieldGenO
}
} else if (a instanceof ExceptionTable) {
String[] names = ((ExceptionTable) a).getExceptionNames();
- for (int j = 0; j < names.length; j++) {
- addException(names[j]);
+ for (String name2 : names) {
+ addException(name2);
}
} else if (a instanceof Annotations) {
Annotations runtimeAnnotations = (Annotations) a;
AnnotationEntry[] aes = runtimeAnnotations.getAnnotationEntries();
- for (int k = 0; k < aes.length; k++) {
- AnnotationEntry element = aes[k];
+ for (AnnotationEntry element : aes) {
addAnnotationEntry(new AnnotationEntryGen(element, cp, false));
}
} else {
@@ -610,8 +606,8 @@ public class MethodGen extends FieldGenO
public void addAnnotationsAsAttribute(ConstantPoolGen cp) {
Attribute[] attrs = Utility.getAnnotationAttributes(cp,annotation_vec);
- for (int i = 0; i < attrs.length; i++) {
- addAttribute(attrs[i]);
+ for (Attribute attr : attrs) {
+ addAttribute(attr);
}
}
@@ -619,8 +615,8 @@ public class MethodGen extends FieldGenO
if (!hasParameterAnnotations) return;
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);
}
}
}
@@ -656,8 +652,8 @@ public class MethodGen extends FieldGenO
/* 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();
int exc_len = c_exc.length * 8; // Every entry takes 8 bytes
@@ -665,8 +661,7 @@ public class MethodGen extends FieldGenO
if ((il != null) && !isAbstract() && !isNative()) {
// Remove any stale code attribute
Attribute[] attributes = getAttributes();
- for (int i = 0; i < attributes.length; i++) {
- Attribute a = attributes[i];
+ for (Attribute a : attributes) {
if (a instanceof Code) {
removeAttribute(a);
}
@@ -720,10 +715,10 @@ public class MethodGen extends FieldGenO
il.delete(ih);
} catch (TargetLostException e) {
InstructionHandle[] targets = e.getTargets();
- for (int i = 0; i < targets.length; i++) {
- InstructionTargeter[] targeters = targets[i].getTargeters();
- for (int j = 0; j < targeters.length; j++) {
- targeters[j].updateTarget(targets[i], next);
+ for (InstructionHandle target : targets) {
+ InstructionTargeter[] targeters = target.getTargeters();
+ for (InstructionTargeter targeter : targeters) {
+ targeter.updateTarget(target, next);
}
}
}
@@ -856,8 +851,8 @@ public class MethodGen extends FieldGenO
if (il != null) {
int max = isStatic() ? 0 : 1;
if (arg_types != null) {
- for (int i = 0; i < arg_types.length; i++) {
- max += arg_types[i].getSize();
+ for (Type arg_type : arg_types) {
+ max += arg_type.getSize();
}
}
for (InstructionHandle ih = il.getStart(); ih != null; ih = ih.getNext()) {
@@ -945,8 +940,8 @@ public class MethodGen extends FieldGenO
* explicitly. in each case, the stack will have depth 1,
* containing the exception object.
*/
- for (int i = 0; i < et.length; i++) {
- InstructionHandle handler_pc = et[i].getHandlerPC();
+ for (CodeExceptionGen element : et) {
+ InstructionHandle handler_pc = element.getHandlerPC();
if (handler_pc != null) {
branchTargets.push(handler_pc, 1);
}
@@ -968,8 +963,8 @@ public class MethodGen extends FieldGenO
// explore all of the select's targets. the default target is handled below.
Select select = (Select) 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;
@@ -1111,9 +1106,7 @@ public class MethodGen extends FieldGenO
Attribute[] attrs = getAttributes();
ParameterAnnotations paramAnnVisAttr = null;
ParameterAnnotations paramAnnInvisAttr = null;
- for (int i = 0; i < attrs.length; i++)
- {
- Attribute attribute = attrs[i];
+ for (Attribute attribute : attrs) {
if (attribute instanceof ParameterAnnotations)
{
// Initialize param_annotations
@@ -1151,9 +1144,8 @@ public class MethodGen extends FieldGenO
private List<AnnotationEntryGen> makeMutableVersion(AnnotationEntry[] mutableArray)
{
List<AnnotationEntryGen> result = new ArrayList<AnnotationEntryGen>();
- for (int i = 0; i < mutableArray.length; i++)
- {
- result.add(new AnnotationEntryGen(mutableArray[i], getConstantPool(),
+ for (AnnotationEntry element : mutableArray) {
+ result.add(new AnnotationEntryGen(element, getConstantPool(),
false));
}
return result;
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReferenceType.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReferenceType.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReferenceType.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReferenceType.java Tue Dec 31 22:05:01 2013
@@ -165,8 +165,8 @@ public abstract class ReferenceType exte
// on one of them "interfaces implemented by arrays" is exchanged with "'Cloneable' or
// 'java.io.Serializable'"
if ((T instanceof ObjectType) && (((ObjectType) T).referencesInterfaceExact())) {
- for (int ii = 0; ii < Constants.INTERFACES_IMPLEMENTED_BY_ARRAYS.length; ii++) {
- if (T.equals(ObjectType.getInstance(Constants.INTERFACES_IMPLEMENTED_BY_ARRAYS[ii]))) {
+ for (String element : Constants.INTERFACES_IMPLEMENTED_BY_ARRAYS) {
+ if (T.equals(ObjectType.getInstance(element))) {
return true;
}
}
@@ -249,10 +249,10 @@ public abstract class ReferenceType exte
System.arraycopy(other_sups, 0, t_sups, 1, other_sups.length);
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 ObjectType.getInstance(this_sups[j].getClassName());
+ for (JavaClass t_sup : t_sups) {
+ for (JavaClass this_sup : this_sups) {
+ if (this_sup.equals(t_sup)) {
+ return ObjectType.getInstance(this_sup.getClassName());
}
}
}
@@ -322,10 +322,10 @@ public abstract class ReferenceType exte
System.arraycopy(other_sups, 0, t_sups, 1, other_sups.length);
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 ObjectType.getInstance(this_sups[j].getClassName());
+ for (JavaClass t_sup : t_sups) {
+ for (JavaClass this_sup : this_sups) {
+ if (this_sup.equals(t_sup)) {
+ return ObjectType.getInstance(this_sup.getClassName());
}
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Select.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Select.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Select.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Select.java Tue Dec 31 22:05:01 2013
@@ -63,8 +63,8 @@ public abstract class Select extends Bra
Select(short opcode, int[] match, InstructionHandle[] targets, InstructionHandle defaultTarget) {
super(opcode, defaultTarget);
this.targets = targets;
- for (int i = 0; i < targets.length; i++) {
- notifyTarget(null, targets[i], this);
+ for (InstructionHandle target2 : targets) {
+ notifyTarget(null, target2, this);
}
this.match = match;
if ((match_length = match.length) != targets.length) {
@@ -190,8 +190,8 @@ public abstract class Select extends Bra
if (target == ih) {
return true;
}
- for (int i = 0; i < targets.length; i++) {
- if (targets[i] == ih) {
+ for (InstructionHandle target2 : targets) {
+ if (target2 == ih) {
return true;
}
}
@@ -215,8 +215,8 @@ public abstract class Select extends Bra
@Override
void dispose() {
super.dispose();
- for (int i = 0; i < targets.length; i++) {
- targets[i].removeTargeter(this);
+ for (InstructionHandle target2 : targets) {
+ target2.removeTargeter(this);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java Tue Dec 31 22:05:01 2013
@@ -312,8 +312,8 @@ public abstract class Type implements ja
public static String getSignature( java.lang.reflect.Method meth ) {
StringBuilder sb = new StringBuilder("(");
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(")");
sb.append(getType(meth.getReturnType()).getSignature());
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java Tue Dec 31 22:05:01 2013
@@ -141,11 +141,11 @@ final class AttributeHTML implements org
// List thrown exceptions
int[] indices = ((ExceptionTable) attribute).getExceptionIndexTable();
file.print("<UL>");
- for (int i = 0; i < indices.length; i++) {
- file.print("<LI><A HREF=\"" + class_name + "_cp.html#cp" + indices[i]
- + "\" TARGET=\"ConstantPool\">Exception class index(" + indices[i]
- + ")</A>\n");
- }
+ for (int indice : indices) {
+ file.print("<LI><A HREF=\"" + class_name + "_cp.html#cp" + indice
+ + "\" TARGET=\"ConstantPool\">Exception class index(" + indice
+ + ")</A>\n");
+ }
file.print("</UL>\n");
break;
case ATTR_LINE_NUMBER_TABLE:
@@ -164,42 +164,42 @@ final class AttributeHTML implements org
LocalVariable[] vars = ((LocalVariableTable) attribute).getLocalVariableTable();
// List name, range and type
file.print("<UL>");
- for (int i = 0; i < vars.length; i++) {
- index = vars[i].getSignatureIndex();
- String signature = ((ConstantUtf8) constant_pool.getConstant(index,
- CONSTANT_Utf8)).getBytes();
- signature = Utility.signatureToString(signature, false);
- int start = vars[i].getStartPC();
- int end = (start + vars[i].getLength());
- file.println("<LI>" + Class2HTML.referenceType(signature) + " <B>"
- + vars[i].getName() + "</B> in slot %" + vars[i].getIndex()
- + "<BR>Valid from lines " + "<A HREF=\"" + class_name
- + "_code.html#code" + method_number + "@" + start + "\" TARGET=Code>"
- + start + "</A> to " + "<A HREF=\"" + class_name + "_code.html#code"
- + method_number + "@" + end + "\" TARGET=Code>" + end + "</A></LI>");
- }
+ for (LocalVariable var : vars) {
+ index = var.getSignatureIndex();
+ String signature = ((ConstantUtf8) constant_pool.getConstant(index,
+ CONSTANT_Utf8)).getBytes();
+ signature = Utility.signatureToString(signature, false);
+ int start = var.getStartPC();
+ int end = (start + var.getLength());
+ file.println("<LI>" + Class2HTML.referenceType(signature) + " <B>"
+ + var.getName() + "</B> in slot %" + var.getIndex()
+ + "<BR>Valid from lines " + "<A HREF=\"" + class_name
+ + "_code.html#code" + method_number + "@" + start + "\" TARGET=Code>"
+ + start + "</A> to " + "<A HREF=\"" + class_name + "_code.html#code"
+ + method_number + "@" + end + "\" TARGET=Code>" + end + "</A></LI>");
+ }
file.print("</UL>\n");
break;
case ATTR_INNER_CLASSES:
InnerClass[] classes = ((InnerClasses) attribute).getInnerClasses();
// List inner classes
file.print("<UL>");
- for (int i = 0; i < classes.length; i++) {
- String name, access;
- index = classes[i].getInnerNameIndex();
- if (index > 0) {
- name = ((ConstantUtf8) constant_pool.getConstant(index, CONSTANT_Utf8))
- .getBytes();
- } else {
- name = "<anonymous>";
- }
- access = Utility.accessToString(classes[i].getInnerAccessFlags());
- file.print("<LI><FONT COLOR=\"#FF0000\">" + access + "</FONT> "
- + constant_html.referenceConstant(classes[i].getInnerClassIndex())
- + " in class "
- + constant_html.referenceConstant(classes[i].getOuterClassIndex())
- + " named " + name + "</LI>\n");
+ for (InnerClass classe : classes) {
+ String name, access;
+ index = classe.getInnerNameIndex();
+ if (index > 0) {
+ name = ((ConstantUtf8) constant_pool.getConstant(index, CONSTANT_Utf8))
+ .getBytes();
+ } else {
+ name = "<anonymous>";
}
+ access = Utility.accessToString(classe.getInnerAccessFlags());
+ file.print("<LI><FONT COLOR=\"#FF0000\">" + access + "</FONT> "
+ + constant_html.referenceConstant(classe.getInnerClassIndex())
+ + " in class "
+ + constant_html.referenceConstant(classe.getOuterClassIndex())
+ + " named " + name + "</LI>\n");
+ }
file.print("</UL>\n");
break;
default: // Such as Unknown attribute or Deprecated
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java Tue Dec 31 22:05:01 2013
@@ -336,8 +336,7 @@ class BCELFactory extends EmptyVisitor {
private void updateExceptionHandlers() {
CodeExceptionGen[] handlers = _mg.getExceptionHandlers();
- for (int i = 0; i < handlers.length; i++) {
- CodeExceptionGen h = handlers[i];
+ for (CodeExceptionGen h : handlers) {
String type = (h.getCatchType() == null) ? "null" : BCELifier.printType(h
.getCatchType());
_out.println(" method.addExceptionHandler(" + "ih_" + h.getStartPC().getPosition()
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELifier.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELifier.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELifier.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELifier.java Tue Dec 31 22:05:01 2013
@@ -108,8 +108,8 @@ public class BCELifier extends org.apach
if (fields.length > 0) {
_out.println(" private void createFields() {");
_out.println(" FieldGen field;");
- for (int i = 0; i < fields.length; i++) {
- fields[i].accept(this);
+ for (Field field : fields) {
+ field.accept(this);
}
_out.println(" }");
_out.println();
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java Tue Dec 31 22:05:01 2013
@@ -19,6 +19,7 @@ package org.apache.bcel.util;
import java.io.ByteArrayInputStream;
import java.util.Hashtable;
+
import org.apache.bcel.Constants;
import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.ConstantClass;
@@ -104,8 +105,8 @@ public class ClassLoader extends java.la
/* Second try: Load system class using system class loader. You better
* don't mess around with them.
*/
- for (int i = 0; i < ignored_packages.length; i++) {
- if (class_name.startsWith(ignored_packages[i])) {
+ for (String ignored_package : ignored_packages) {
+ if (class_name.startsWith(ignored_package)) {
cl = getParent().loadClass(class_name);
break;
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassPath.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassPath.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassPath.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassPath.java Tue Dec 31 22:05:01 2013
@@ -167,8 +167,8 @@ public class ClassPath implements Serial
File ext_dir = new File(d);
String[] extensions = ext_dir.list(ARCHIVE_FILTER);
if (extensions != null) {
- for (int i = 0; i < extensions.length; i++) {
- list.add(ext_dir.getPath() + File.separatorChar + extensions[i]);
+ for (String extension : extensions) {
+ list.add(ext_dir.getPath() + File.separatorChar + extension);
}
}
}
@@ -216,9 +216,9 @@ public class ClassPath implements Serial
* @return InputStream supplying the resource, or null if no resource with that name.
*/
public InputStream getResourceAsStream(String name) {
- for (int i = 0; i < paths.length; i++) {
+ for (PathEntry path : paths) {
InputStream is;
- if ((is = paths[i].getResourceAsStream(name)) != null) {
+ if ((is = path.getResourceAsStream(name)) != null) {
return is;
}
}
@@ -230,9 +230,9 @@ public class ClassPath implements Serial
* @return URL supplying the resource, or null if no resource with that name.
*/
public URL getResource(String name) {
- for (int i = 0; i < paths.length; i++) {
+ for (PathEntry path : paths) {
URL url;
- if ((url = paths[i].getResource(name)) != null) {
+ if ((url = path.getResource(name)) != null) {
return url;
}
}
@@ -246,9 +246,9 @@ public class ClassPath implements Serial
*/
public Enumeration<URL> getResources(String name) {
Vector<URL> results = new Vector<URL>();
- for (int i = 0; i < paths.length; i++) {
+ for (PathEntry path : paths) {
URL url;
- if ((url = paths[i].getResource(name)) != null) {
+ if ((url = path.getResource(name)) != null) {
results.add(url);
}
}
@@ -261,7 +261,7 @@ public class ClassPath implements Serial
* @return class file for the java class
*/
public ClassFile getClassFile( String name, String suffix ) throws IOException {
- for (int i = 0; i < paths.length; i++) {
+ for (PathEntry path : paths) {
ClassFile cf = null;
if(parent != null) {
@@ -282,8 +282,8 @@ public class ClassPath implements Serial
private ClassFile getClassFileInternal(String name, String suffix) throws IOException {
- for(int i=0; i < paths.length; i++) {
- ClassFile cf = paths[i].getClassFile(name, suffix);
+ for (PathEntry path : paths) {
+ ClassFile cf = path.getClassFile(name, suffix);
if(cf != null) {
return cf;
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/CodeHTML.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/CodeHTML.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/CodeHTML.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/CodeHTML.java Tue Dec 31 22:05:01 2013
@@ -112,10 +112,10 @@ final class CodeHTML implements org.apac
}
buf.append("<TH>default</TH></TR>\n<TR>");
// Print target and default indices in second row
- for (int i = 0; i < jump_table.length; i++) {
- buf.append("<TD><A HREF=\"#code").append(method_number).append("@").append(
- jump_table[i]).append("\">").append(jump_table[i]).append("</A></TD>");
- }
+ for (int element : jump_table) {
+ buf.append("<TD><A HREF=\"#code").append(method_number).append("@").append(
+ element).append("\">").append(element).append("</A></TD>");
+ }
buf.append("<TD><A HREF=\"#code").append(method_number).append("@").append(
default_offset).append("\">").append(default_offset).append(
"</A></TD></TR>\n</TABLE>\n");
@@ -382,13 +382,13 @@ final class CodeHTML implements org.apac
}
// Look for local variables and their range
Attribute[] attributes = code.getAttributes();
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i].getTag() == ATTR_LOCAL_VARIABLE_TABLE) {
- LocalVariable[] vars = ((LocalVariableTable) attributes[i])
+ for (Attribute attribute : attributes) {
+ if (attribute.getTag() == ATTR_LOCAL_VARIABLE_TABLE) {
+ LocalVariable[] vars = ((LocalVariableTable) attribute)
.getLocalVariableTable();
- for (int j = 0; j < vars.length; j++) {
- int start = vars[j].getStartPC();
- int end = (start + vars[j].getLength());
+ for (LocalVariable var : vars) {
+ int start = var.getStartPC();
+ int end = (start + var.getLength());
goto_set.set(start);
goto_set.set(end);
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/MethodHTML.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/MethodHTML.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/MethodHTML.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/MethodHTML.java Tue Dec 31 22:05:01 2013
@@ -52,8 +52,8 @@ final class MethodHTML implements org.ap
file.println("<HTML><BODY BGCOLOR=\"#C0C0C0\"><TABLE BORDER=0>");
file.println("<TR><TH ALIGN=LEFT>Access flags</TH><TH ALIGN=LEFT>Type</TH>"
+ "<TH ALIGN=LEFT>Field name</TH></TR>");
- for (int i = 0; i < fields.length; i++) {
- writeField(fields[i]);
+ for (Field field : fields) {
+ writeField(field);
}
file.println("</TABLE>");
file.println("<TABLE BORDER=0><TR><TH ALIGN=LEFT>Access flags</TH>"
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/Verifier.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/Verifier.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/Verifier.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/Verifier.java Tue Dec 31 22:05:01 2013
@@ -149,32 +149,32 @@ public class Verifier {
List<String> messages = new ArrayList<String>();
if (p1v != null) {
String[] p1m = p1v.getMessages();
- for (int i = 0; i < p1m.length; i++) {
- messages.add("Pass 1: " + p1m[i]);
+ for (String element : p1m) {
+ messages.add("Pass 1: " + element);
}
}
if (p2v != null) {
String[] p2m = p2v.getMessages();
- for (int i = 0; i < p2m.length; i++) {
- messages.add("Pass 2: " + p2m[i]);
+ for (String element : p2m) {
+ messages.add("Pass 2: " + element);
}
}
for (Pass3aVerifier pv : p3avs.values()) {
String[] p3am = pv.getMessages();
int meth = pv.getMethodNo();
- for (int i = 0; i < p3am.length; i++) {
+ for (String element : p3am) {
messages.add("Pass 3a, method " + meth + " ('"
+ org.apache.bcel.Repository.lookupClass(classname).getMethods()[meth]
- + "'): " + p3am[i]);
+ + "'): " + element);
}
}
for (Pass3bVerifier pv : p3bvs.values()) {
String[] p3bm = pv.getMessages();
int meth = pv.getMethodNo();
- for (int i = 0; i < p3bm.length; i++) {
+ for (String element : p3bm) {
messages.add("Pass 3b, method " + meth + " ('"
+ org.apache.bcel.Repository.lookupClass(classname).getMethods()[meth]
- + "'): " + p3bm[i]);
+ + "'): " + element);
}
}
String[] ret = new String[messages.size()];
@@ -230,8 +230,8 @@ public class Verifier {
if (warnings.length == 0) {
System.out.println("<none>");
}
- for (int j = 0; j < warnings.length; j++) {
- System.out.println(warnings[j]);
+ for (String warning : warnings) {
+ System.out.println(warning);
}
System.out.println("\n");
// avoid swapping.
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifyDialog.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifyDialog.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifyDialog.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifyDialog.java Tue Dec 31 22:05:01 2013
@@ -17,6 +17,7 @@
package org.apache.bcel.verifier;
import java.awt.Color;
+
import org.apache.bcel.Repository;
import org.apache.bcel.classfile.JavaClass;
@@ -465,10 +466,10 @@ public class VerifyDialog extends javax.
*/
public static void main( java.lang.String[] args ) {
classes_to_verify = args.length;
- for (int i = 0; i < args.length; i++) {
+ for (String arg : args) {
try {
VerifyDialog aVerifyDialog;
- aVerifyDialog = new VerifyDialog(args[i]);
+ aVerifyDialog = new VerifyDialog(arg);
aVerifyDialog.setModal(true);
aVerifyDialog.addWindowListener(new java.awt.event.WindowAdapter() {
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/IntList.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/IntList.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/IntList.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/IntList.java Tue Dec 31 22:05:01 2013
@@ -42,8 +42,8 @@ public class IntList{
boolean contains(int i){
Integer[] ints = new Integer[theList.size()];
theList.toArray(ints);
- for (int j=0; j<ints.length; j++){
- if (i == ints[j].intValue()) {
+ for (Integer k : ints) {
+ if (i == k.intValue()) {
return true;
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java?rev=1554576&r1=1554575&r2=1554576&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java Tue Dec 31 22:05:01 2013
@@ -628,8 +628,8 @@ public final class Pass2Verifier extends
}
}
- for (int i=0; i<ts.length; i++){
- act = ts[i];
+ for (Type element : ts) {
+ act = element;
if (act instanceof ArrayType) {
act = ((ArrayType) act).getBasicType();
}
@@ -818,20 +818,20 @@ public final class Pass2Verifier extends
InnerClass[] ics = obj.getInnerClasses();
- for (int i=0; i<ics.length; i++){
- checkIndex(obj, ics[i].getInnerClassIndex(), CONST_Class);
- int outer_idx = ics[i].getOuterClassIndex();
+ for (InnerClass ic : ics) {
+ checkIndex(obj, ic.getInnerClassIndex(), CONST_Class);
+ int outer_idx = ic.getOuterClassIndex();
if (outer_idx != 0){
checkIndex(obj, outer_idx, CONST_Class);
}
- int innername_idx = ics[i].getInnerNameIndex();
+ int innername_idx = ic.getInnerNameIndex();
if (innername_idx != 0){
checkIndex(obj, innername_idx, CONST_Utf8);
}
- int acc = ics[i].getInnerAccessFlags();
+ int acc = ic.getInnerAccessFlags();
acc = acc & (~ (ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED | ACC_STATIC | ACC_FINAL | ACC_INTERFACE | ACC_ABSTRACT));
if (acc != 0){
- addMessage("Unknown access flag for inner class '"+tostring(ics[i])+"' set (InnerClasses attribute '"+tostring(obj)+"').");
+ addMessage("Unknown access flag for inner class '"+tostring(ic)+"' set (InnerClasses attribute '"+tostring(obj)+"').");
}
}
// Semantical consistency is not yet checked by Sun, see vmspec2 4.7.5.
@@ -916,8 +916,8 @@ public final class Pass2Verifier extends
//In JustIce, the check for correct offsets into the code array is delayed to Pass 3a.
CodeException[] exc_table = obj.getExceptionTable();
- for (int i=0; i<exc_table.length; i++){
- int exc_index = exc_table[i].getCatchType();
+ for (CodeException element : exc_table) {
+ int exc_index = element.getCatchType();
if (exc_index != 0){ // if 0, it catches all Throwables
checkIndex(obj, exc_index, CONST_Class);
ConstantClass cc = (ConstantClass) (cp.getConstant(exc_index));
@@ -928,7 +928,7 @@ public final class Pass2Verifier extends
VerificationResult vr = v.doPass1();
if (vr != VerificationResult.VR_OK){
- throw new ClassConstraintException("Code attribute '"+tostring(obj)+"' (method '"+m+"') has an exception_table entry '"+tostring(exc_table[i])+"' that references '"+cname+"' as an Exception but it does not pass verification pass 1: "+vr);
+ throw new ClassConstraintException("Code attribute '"+tostring(obj)+"' (method '"+m+"') has an exception_table entry '"+tostring(element)+"' that references '"+cname+"' as an Exception but it does not pass verification pass 1: "+vr);
}
else{
// We cannot safely trust any other "instanceof" mechanism. We need to transitively verify
@@ -944,14 +944,14 @@ public final class Pass2Verifier extends
v = VerifierFactory.getVerifier(e.getSuperclassName());
vr = v.doPass1();
if (vr != VerificationResult.VR_OK){
- throw new ClassConstraintException("Code attribute '"+tostring(obj)+"' (method '"+m+"') has an exception_table entry '"+tostring(exc_table[i])+"' that references '"+cname+"' as an Exception but '"+e.getSuperclassName()+"' in the ancestor hierachy does not pass verification pass 1: "+vr);
+ throw new ClassConstraintException("Code attribute '"+tostring(obj)+"' (method '"+m+"') has an exception_table entry '"+tostring(element)+"' that references '"+cname+"' as an Exception but '"+e.getSuperclassName()+"' in the ancestor hierachy does not pass verification pass 1: "+vr);
}
else{
e = Repository.lookupClass(e.getSuperclassName());
}
}
if (e != t) {
- throw new ClassConstraintException("Code attribute '"+tostring(obj)+"' (method '"+m+"') has an exception_table entry '"+tostring(exc_table[i])+"' that references '"+cname+"' as an Exception but it is not a subclass of '"+t.getClassName()+"'.");
+ throw new ClassConstraintException("Code attribute '"+tostring(obj)+"' (method '"+m+"') has an exception_table entry '"+tostring(element)+"' that references '"+cname+"' as an Exception but it is not a subclass of '"+t.getClassName()+"'.");
}
}
}
@@ -1005,29 +1005,29 @@ public final class Pass2Verifier extends
//In JustIce, the check for correct offsets into the code array is delayed to Pass 3a.
LocalVariable[] localvariables = lvt.getLocalVariableTable();
- for (int i=0; i<localvariables.length; i++){
- checkIndex(lvt, localvariables[i].getNameIndex(), CONST_Utf8);
- String localname = ((ConstantUtf8) cp.getConstant(localvariables[i].getNameIndex())).getBytes();
+ for (LocalVariable localvariable : localvariables) {
+ checkIndex(lvt, localvariable.getNameIndex(), CONST_Utf8);
+ String localname = ((ConstantUtf8) cp.getConstant(localvariable.getNameIndex())).getBytes();
if (!validJavaIdentifier(localname)){
throw new ClassConstraintException("LocalVariableTable '"+tostring(lvt)+"' references a local variable by the name '"+localname+"' which is not a legal Java simple name.");
}
- checkIndex(lvt, localvariables[i].getSignatureIndex(), CONST_Utf8);
- String localsig = ((ConstantUtf8) (cp.getConstant(localvariables[i].getSignatureIndex()))).getBytes(); // Local signature(=descriptor)
+ checkIndex(lvt, localvariable.getSignatureIndex(), CONST_Utf8);
+ String localsig = ((ConstantUtf8) (cp.getConstant(localvariable.getSignatureIndex()))).getBytes(); // Local signature(=descriptor)
Type t;
try{
t = Type.getType(localsig);
}
catch (ClassFormatException cfe){
- throw new ClassConstraintException("Illegal descriptor (==signature) '"+localsig+"' used by LocalVariable '"+tostring(localvariables[i])+"' referenced by '"+tostring(lvt)+"'.", cfe);
+ throw new ClassConstraintException("Illegal descriptor (==signature) '"+localsig+"' used by LocalVariable '"+tostring(localvariable)+"' referenced by '"+tostring(lvt)+"'.", cfe);
}
- int localindex = localvariables[i].getIndex();
+ int localindex = localvariable.getIndex();
if ( ( (t==Type.LONG || t==Type.DOUBLE)? localindex+1:localindex) >= code.getMaxLocals()){
- throw new ClassConstraintException("LocalVariableTable attribute '"+tostring(lvt)+"' references a LocalVariable '"+tostring(localvariables[i])+"' with an index that exceeds the surrounding Code attribute's max_locals value of '"+code.getMaxLocals()+"'.");
+ throw new ClassConstraintException("LocalVariableTable attribute '"+tostring(lvt)+"' references a LocalVariable '"+tostring(localvariable)+"' with an index that exceeds the surrounding Code attribute's max_locals value of '"+code.getMaxLocals()+"'.");
}
try{
- localVariablesInfos[method_number].add(localindex, localname, localvariables[i].getStartPC(), localvariables[i].getLength(), t);
+ localVariablesInfos[method_number].add(localindex, localname, localvariable.getStartPC(), localvariable.getLength(), t);
}
catch(LocalVariableInfoInconsistentException lviie){
throw new ClassConstraintException("Conflicting information in LocalVariableTable '"+tostring(lvt)+"' found in Code attribute '"+tostring(obj)+"' (method '"+tostring(m)+"'). "+lviie.getMessage(), lviie);
@@ -1061,10 +1061,10 @@ public final class Pass2Verifier extends
int[] exc_indices = obj.getExceptionIndexTable();
- for (int i=0; i<exc_indices.length; i++){
- checkIndex(obj, exc_indices[i], CONST_Class);
+ for (int exc_indice : exc_indices) {
+ checkIndex(obj, exc_indice, CONST_Class);
- ConstantClass cc = (ConstantClass) (cp.getConstant(exc_indices[i]));
+ ConstantClass cc = (ConstantClass) (cp.getConstant(exc_indice));
checkIndex(cc, cc.getNameIndex(), CONST_Utf8); // cannot be sure this ConstantClass has already been visited (checked)!
String cname = ((ConstantUtf8) cp.getConstant(cc.getNameIndex())).getBytes().replace('/','.'); //convert internal notation on-the-fly to external notation