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 2016/06/21 20:50:21 UTC
svn commit: r1749603 [6/9] - in /commons/proper/bcel/trunk/src:
main/java/org/apache/bcel/ 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/...
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=1749603&r1=1749602&r2=1749603&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 Jun 21 20:50:19 2016
@@ -39,9 +39,9 @@ public class IntList{
}
/** Checks if the specified int is already in the list. */
boolean contains(final int i) {
- Integer[] ints = new Integer[theList.size()];
+ final Integer[] ints = new Integer[theList.size()];
theList.toArray(ints);
- for (Integer k : ints) {
+ for (final Integer k : ints) {
if (i == k.intValue()) {
return true;
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass1Verifier.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass1Verifier.java?rev=1749603&r1=1749602&r2=1749603&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass1Verifier.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass1Verifier.java Tue Jun 21 20:50:19 2016
@@ -56,7 +56,7 @@ public final class Pass1Verifier extends
if (jc == null) {
try {
jc = Repository.lookupClass(myOwner.getClassName());
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: currently, Pass1Verifier treats jc == null as a special
// case, so we don't need to do anything here. A better solution
// would be to simply throw the ClassNotFoundException
@@ -160,13 +160,13 @@ public final class Pass1Verifier extends
}
}
- catch(LoadingException e) {
+ catch(final LoadingException e) {
return new VerificationResult(VerificationResult.VERIFIED_REJECTED, e.getMessage());
}
- catch(ClassFormatException e) {
+ catch(final ClassFormatException e) {
return new VerificationResult(VerificationResult.VERIFIED_REJECTED, e.getMessage());
}
- catch(RuntimeException e) {
+ catch(final RuntimeException e) {
// BCEL does not catch every possible RuntimeException; e.g. if
// a constant pool index is referenced that does not exist.
return new VerificationResult(VerificationResult.VERIFIED_REJECTED, "Parsing via BCEL did not succeed. "+
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=1749603&r1=1749602&r2=1749603&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 Jun 21 20:50:19 2016
@@ -149,7 +149,7 @@ public final class Pass2Verifier extends
@Override
public VerificationResult do_verify() {
try {
- VerificationResult vr1 = myOwner.doPass1();
+ final VerificationResult vr1 = myOwner.doPass1();
if (vr1.equals(VerificationResult.VR_OK)) {
// For every method, we could have information about the local variables out of LocalVariableTable attributes of
@@ -163,14 +163,14 @@ public final class Pass2Verifier extends
every_class_has_an_accessible_superclass();
final_methods_are_not_overridden();
}
- catch (ClassConstraintException cce) {
+ catch (final ClassConstraintException cce) {
vr = new VerificationResult(VerificationResult.VERIFIED_REJECTED, cce.getMessage());
}
return vr;
}
return VerificationResult.VR_NOTYET;
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -191,7 +191,7 @@ public final class Pass2Verifier extends
*/
private void every_class_has_an_accessible_superclass() {
try {
- Set<String> hs = new HashSet<>(); // save class names to detect circular inheritance
+ final Set<String> hs = new HashSet<>(); // save class names to detect circular inheritance
JavaClass jc = Repository.lookupClass(myOwner.getClassName());
int supidx = -1;
@@ -205,12 +205,12 @@ public final class Pass2Verifier extends
}
}
else{
- String supername = jc.getSuperclassName();
+ final String supername = jc.getSuperclassName();
if (! hs.add(supername)) { // If supername already is in the list
throw new ClassConstraintException("Circular superclass hierarchy detected.");
}
- Verifier v = VerifierFactory.getVerifier(supername);
- VerificationResult vr = v.doPass1();
+ final Verifier v = VerifierFactory.getVerifier(supername);
+ final VerificationResult vr = v.doPass1();
if (vr != VerificationResult.VR_OK) {
throw new ClassConstraintException("Could not load in ancestor class '"+supername+"'.");
@@ -224,7 +224,7 @@ public final class Pass2Verifier extends
}
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -243,16 +243,16 @@ public final class Pass2Verifier extends
*/
private void final_methods_are_not_overridden() {
try {
- Map<String, String> hashmap = new HashMap<>();
+ final Map<String, String> hashmap = new HashMap<>();
JavaClass jc = Repository.lookupClass(myOwner.getClassName());
int supidx = -1;
while (supidx != 0) {
supidx = jc.getSuperclassNameIndex();
- Method[] methods = jc.getMethods();
- for (Method method : methods) {
- String nameAndSig = method.getName() + method.getSignature();
+ final Method[] methods = jc.getMethods();
+ for (final Method method : methods) {
+ final String nameAndSig = method.getName() + method.getSignature();
if (hashmap.containsKey(nameAndSig)) {
if (method.isFinal()) {
@@ -280,7 +280,7 @@ public final class Pass2Verifier extends
// Well, for OBJECT this returns OBJECT so it works (could return anything but must not throw an Exception).
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -298,10 +298,10 @@ public final class Pass2Verifier extends
// Most of the consistency is handled internally by BCEL; here
// we only have to verify if the indices of the constants point
// to constants of the appropriate type and such.
- JavaClass jc = Repository.lookupClass(myOwner.getClassName());
+ final JavaClass jc = Repository.lookupClass(myOwner.getClassName());
new CPESSC_Visitor(jc); // constructor implicitly traverses jc
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -365,7 +365,7 @@ public final class Pass2Verifier extends
if ((index < 0) || (index >= cplen)) {
throw new ClassConstraintException("Invalid index '"+index+"' used by '"+tostring(referrer)+"'.");
}
- Constant c = cp.getConstant(index);
+ final Constant c = cp.getConstant(index);
if (! shouldbe.isInstance(c)) {
/* String isnot = shouldbe.toString().substring(shouldbe.toString().lastIndexOf(".")+1); //Cut all before last "." */
throw new ClassCastException("Illegal constant '"+tostring(c)+"' at index '"+
@@ -377,15 +377,15 @@ public final class Pass2Verifier extends
///////////////////////////////////////
@Override
public void visitJavaClass(final JavaClass obj) {
- Attribute[] atts = obj.getAttributes();
+ final Attribute[] atts = obj.getAttributes();
boolean foundSourceFile = false;
boolean foundInnerClasses = false;
// Is there an InnerClass referenced?
// This is a costly check; existing verifiers don't do it!
- boolean hasInnerClass = new InnerClassDetector(jc).innerClassReferenced();
+ final boolean hasInnerClass = new InnerClassDetector(jc).innerClassReferenced();
- for (Attribute att : atts) {
+ for (final Attribute att : atts) {
if ((!(att instanceof SourceFile)) &&
(!(att instanceof Deprecated)) &&
(!(att instanceof InnerClasses)) &&
@@ -570,7 +570,7 @@ public final class Pass2Verifier extends
checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
- String name = obj.getName();
+ final String name = obj.getName();
if (! validFieldName(name)) {
throw new ClassConstraintException("Field '"+tostring(obj)+"' has illegal name '"+obj.getName()+"'.");
}
@@ -578,16 +578,16 @@ public final class Pass2Verifier extends
// A descriptor is often named signature in BCEL
checkIndex(obj, obj.getSignatureIndex(), CONST_Utf8);
- String sig = ((ConstantUtf8) (cp.getConstant(obj.getSignatureIndex()))).getBytes(); // Field or Method sig.(=descriptor)
+ final String sig = ((ConstantUtf8) (cp.getConstant(obj.getSignatureIndex()))).getBytes(); // Field or Method sig.(=descriptor)
try{
Type.getType(sig); /* Don't need the return value */
}
- catch (ClassFormatException cfe) {
+ catch (final ClassFormatException cfe) {
throw new ClassConstraintException("Illegal descriptor (==signature) '"+sig+"' used by '"+tostring(obj)+"'.", cfe);
}
- String nameanddesc = name+sig;
+ final String nameanddesc = name+sig;
if (field_names_and_desc.contains(nameanddesc)) {
throw new ClassConstraintException("No two fields (like '"+tostring(obj)+
"') are allowed have same names and descriptors!");
@@ -599,8 +599,8 @@ public final class Pass2Verifier extends
field_names_and_desc.add(nameanddesc);
field_names.add(name);
- Attribute[] atts = obj.getAttributes();
- for (Attribute att : atts) {
+ final Attribute[] atts = obj.getAttributes();
+ for (final Attribute att : atts) {
if ((!(att instanceof ConstantValue)) &&
(!(att instanceof Synthetic)) &&
(!(att instanceof Deprecated))) {
@@ -621,7 +621,7 @@ public final class Pass2Verifier extends
checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
- String name = obj.getName();
+ final String name = obj.getName();
if (! validMethodName(name, true)) {
throw new ClassConstraintException("Method '"+tostring(obj)+"' has illegal name '"+name+"'.");
}
@@ -629,7 +629,7 @@ public final class Pass2Verifier extends
// A descriptor is often named signature in BCEL
checkIndex(obj, obj.getSignatureIndex(), CONST_Utf8);
- String sig = ((ConstantUtf8) (cp.getConstant(obj.getSignatureIndex()))).getBytes(); // Method's signature(=descriptor)
+ final String sig = ((ConstantUtf8) (cp.getConstant(obj.getSignatureIndex()))).getBytes(); // Method's signature(=descriptor)
Type t;
Type[] ts; // needed below the try block.
@@ -637,7 +637,7 @@ public final class Pass2Verifier extends
t = Type.getReturnType(sig);
ts = Type.getArgumentTypes(sig);
}
- catch (ClassFormatException cfe) {
+ catch (final ClassFormatException cfe) {
throw new ClassConstraintException(
"Illegal descriptor (==signature) '"+sig+"' used by Method '"+tostring(obj)+"'.", cfe);
}
@@ -648,22 +648,22 @@ public final class Pass2Verifier extends
act = ((ArrayType) act).getBasicType();
}
if (act instanceof ObjectType) {
- Verifier v = VerifierFactory.getVerifier( ((ObjectType) act).getClassName() );
- VerificationResult vr = v.doPass1();
+ final Verifier v = VerifierFactory.getVerifier( ((ObjectType) act).getClassName() );
+ final VerificationResult vr = v.doPass1();
if (vr != VerificationResult.VR_OK) {
throw new ClassConstraintException(
"Method '"+tostring(obj)+"' has a return type that does not pass verification pass 1: '"+vr+"'.");
}
}
- for (Type element : ts) {
+ for (final Type element : ts) {
act = element;
if (act instanceof ArrayType) {
act = ((ArrayType) act).getBasicType();
}
if (act instanceof ObjectType) {
- Verifier v = VerifierFactory.getVerifier( ((ObjectType) act).getClassName() );
- VerificationResult vr = v.doPass1();
+ final Verifier v = VerifierFactory.getVerifier( ((ObjectType) act).getClassName() );
+ final VerificationResult vr = v.doPass1();
if (vr != VerificationResult.VR_OK) {
throw new ClassConstraintException(
"Method '"+tostring(obj)+"' has an argument type that does not pass verification pass 1: '"+vr+"'.");
@@ -783,16 +783,16 @@ public final class Pass2Verifier extends
" ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT, ACC_STRICT set (ignored).");
}
- String nameanddesc = name+sig;
+ final String nameanddesc = name+sig;
if (method_names_and_desc.contains(nameanddesc)) {
throw new ClassConstraintException(
"No two methods (like '"+tostring(obj)+"') are allowed have same names and desciptors!");
}
method_names_and_desc.add(nameanddesc);
- Attribute[] atts = obj.getAttributes();
+ final Attribute[] atts = obj.getAttributes();
int num_code_atts = 0;
- for (Attribute att : atts) {
+ for (final Attribute att : atts) {
if ((!(att instanceof Code)) &&
(!(att instanceof ExceptionTable)) &&
(!(att instanceof Synthetic)) &&
@@ -828,7 +828,7 @@ public final class Pass2Verifier extends
checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
- String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
+ final String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
if (! name.equals("SourceFile")) {
throw new ClassConstraintException(
"The SourceFile attribute '"+tostring(obj)+"' is not correctly named 'SourceFile' but '"+name+"'.");
@@ -836,8 +836,8 @@ public final class Pass2Verifier extends
checkIndex(obj, obj.getSourceFileIndex(), CONST_Utf8);
- String sourcefilename = ((ConstantUtf8) cp.getConstant(obj.getSourceFileIndex())).getBytes(); //==obj.getSourceFileName() ?
- String sourcefilenamelc = sourcefilename.toLowerCase(Locale.ENGLISH);
+ final String sourcefilename = ((ConstantUtf8) cp.getConstant(obj.getSourceFileIndex())).getBytes(); //==obj.getSourceFileName() ?
+ final String sourcefilenamelc = sourcefilename.toLowerCase(Locale.ENGLISH);
if ( (sourcefilename.indexOf('/') != -1) ||
(sourcefilename.indexOf('\\') != -1) ||
@@ -852,7 +852,7 @@ public final class Pass2Verifier extends
public void visitDeprecated(final Deprecated obj) {//vmspec2 4.7.10
checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
- String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
+ final String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
if (! name.equals("Deprecated")) {
throw new ClassConstraintException("The Deprecated attribute '"+tostring(obj)+
"' is not correctly named 'Deprecated' but '"+name+"'.");
@@ -861,7 +861,7 @@ public final class Pass2Verifier extends
@Override
public void visitSynthetic(final Synthetic obj) {//vmspec2 4.7.6
checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
- String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
+ final String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
if (! name.equals("Synthetic")) {
throw new ClassConstraintException(
"The Synthetic attribute '"+tostring(obj)+"' is not correctly named 'Synthetic' but '"+name+"'.");
@@ -874,21 +874,21 @@ public final class Pass2Verifier extends
checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
- String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
+ final String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
if (! name.equals("InnerClasses")) {
throw new ClassConstraintException(
"The InnerClasses attribute '"+tostring(obj)+"' is not correctly named 'InnerClasses' but '"+name+"'.");
}
- InnerClass[] ics = obj.getInnerClasses();
+ final InnerClass[] ics = obj.getInnerClasses();
- for (InnerClass ic : ics) {
+ for (final InnerClass ic : ics) {
checkIndex(obj, ic.getInnerClassIndex(), CONST_Class);
- int outer_idx = ic.getOuterClassIndex();
+ final int outer_idx = ic.getOuterClassIndex();
if (outer_idx != 0) {
checkIndex(obj, outer_idx, CONST_Class);
}
- int innername_idx = ic.getInnerNameIndex();
+ final int innername_idx = ic.getInnerNameIndex();
if (innername_idx != 0) {
checkIndex(obj, innername_idx, CONST_Utf8);
}
@@ -912,23 +912,23 @@ public final class Pass2Verifier extends
// not a constant!
checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
- String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
+ final String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
if (! name.equals("ConstantValue")) {
throw new ClassConstraintException(
"The ConstantValue attribute '"+tostring(obj)+"' is not correctly named 'ConstantValue' but '"+name+"'.");
}
- Object pred = carrier.predecessor();
+ final Object pred = carrier.predecessor();
if (pred instanceof Field) { //ConstantValue attributes are quite senseless if the predecessor is not a field.
- Field f = (Field) pred;
+ final Field f = (Field) pred;
// Field constraints have been checked before -- so we are safe using their type information.
- Type field_type = Type.getType(((ConstantUtf8) (cp.getConstant(f.getSignatureIndex()))).getBytes());
+ final Type field_type = Type.getType(((ConstantUtf8) (cp.getConstant(f.getSignatureIndex()))).getBytes());
- int index = obj.getConstantValueIndex();
+ final int index = obj.getConstantValueIndex();
if ((index < 0) || (index >= cplen)) {
throw new ClassConstraintException("Invalid index '"+index+"' used by '"+tostring(obj)+"'.");
}
- Constant c = cp.getConstant(index);
+ final Constant c = cp.getConstant(index);
if (CONST_Long.isInstance(c) && field_type.equals(Type.LONG)) {
return;
@@ -964,7 +964,7 @@ public final class Pass2Verifier extends
checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
- String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
+ final String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
if (! name.equals("Code")) {
throw new ClassConstraintException(
"The Code attribute '"+tostring(obj)+"' is not correctly named 'Code' but '"+name+"'.");
@@ -985,15 +985,15 @@ 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 (CodeException element : exc_table) {
- int exc_index = element.getCatchType();
+ final CodeException[] exc_table = obj.getExceptionTable();
+ for (final CodeException element : exc_table) {
+ final 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));
+ final ConstantClass cc = (ConstantClass) (cp.getConstant(exc_index));
// cannot be sure this ConstantClass has already been visited (checked)!
checkIndex(cc, cc.getNameIndex(), CONST_Utf8);
- String cname = ((ConstantUtf8) cp.getConstant(cc.getNameIndex())).getBytes().replace('/','.');
+ final String cname = ((ConstantUtf8) cp.getConstant(cc.getNameIndex())).getBytes().replace('/','.');
Verifier v = VerifierFactory.getVerifier(cname);
VerificationResult vr = v.doPass1();
@@ -1006,8 +1006,8 @@ public final class Pass2Verifier extends
// We cannot safely trust any other "instanceof" mechanism. We need to transitively verify
// the ancestor hierarchy.
JavaClass e = Repository.lookupClass(cname);
- JavaClass t = Repository.lookupClass(Type.THROWABLE.getClassName());
- JavaClass o = Repository.lookupClass(Type.OBJECT.getClassName());
+ final JavaClass t = Repository.lookupClass(Type.THROWABLE.getClassName());
+ final JavaClass o = Repository.lookupClass(Type.OBJECT.getClassName());
while (e != o) {
if (e == t) {
break; // It's a subclass of Throwable, OKAY, leave.
@@ -1035,7 +1035,7 @@ public final class Pass2Verifier extends
// This is highly unelegant due to usage of the Visitor pattern.
// TODO: rework it.
int method_number = -1;
- Method[] ms = Repository.lookupClass(myOwner.getClassName()).getMethods();
+ final Method[] ms = Repository.lookupClass(myOwner.getClassName()).getMethods();
for (int mn=0; mn<ms.length; mn++) {
if (m == ms[mn]) {
method_number = mn;
@@ -1050,7 +1050,7 @@ public final class Pass2Verifier extends
int num_of_lvt_attribs = 0;
// Now iterate through the attributes the Code attribute has.
- Attribute[] atts = obj.getAttributes();
+ final Attribute[] atts = obj.getAttributes();
for (int a=0; a<atts.length; a++) {
if ((! (atts[a] instanceof LineNumberTable)) &&
(! (atts[a] instanceof LocalVariableTable))) {
@@ -1068,41 +1068,41 @@ public final class Pass2Verifier extends
//one certain Code attribute.
if (atts[a] instanceof LocalVariableTable) { // checks conforming to vmspec2 4.7.9
- LocalVariableTable lvt = (LocalVariableTable) atts[a];
+ final LocalVariableTable lvt = (LocalVariableTable) atts[a];
checkIndex(lvt, lvt.getNameIndex(), CONST_Utf8);
- String lvtname = ((ConstantUtf8) cp.getConstant(lvt.getNameIndex())).getBytes();
+ final String lvtname = ((ConstantUtf8) cp.getConstant(lvt.getNameIndex())).getBytes();
if (! lvtname.equals("LocalVariableTable")) {
throw new ClassConstraintException("The LocalVariableTable attribute '"+tostring(lvt)+
"' is not correctly named 'LocalVariableTable' but '"+lvtname+"'.");
}
- Code code = obj;
+ final Code code = obj;
//In JustIce, the check for correct offsets into the code array is delayed to Pass 3a.
- LocalVariable[] localvariables = lvt.getLocalVariableTable();
+ final LocalVariable[] localvariables = lvt.getLocalVariableTable();
- for (LocalVariable localvariable : localvariables) {
+ for (final LocalVariable localvariable : localvariables) {
checkIndex(lvt, localvariable.getNameIndex(), CONST_Utf8);
- String localname = ((ConstantUtf8) cp.getConstant(localvariable.getNameIndex())).getBytes();
+ final 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, localvariable.getSignatureIndex(), CONST_Utf8);
- String localsig =
+ final String localsig =
((ConstantUtf8) (cp.getConstant(localvariable.getSignatureIndex()))).getBytes(); // Local sig.(=descriptor)
Type t;
try{
t = Type.getType(localsig);
}
- catch (ClassFormatException cfe) {
+ catch (final ClassFormatException cfe) {
throw new ClassConstraintException("Illegal descriptor (==signature) '"+localsig+
"' used by LocalVariable '"+tostring(localvariable)+"' referenced by '"+tostring(lvt)+"'.", cfe);
}
- int localindex = localvariable.getIndex();
+ final 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(localvariable)+
@@ -1114,7 +1114,7 @@ public final class Pass2Verifier extends
localVariablesInfos[method_number].add(localindex, localname, localvariable.getStartPC(),
localvariable.getLength(), t);
}
- catch(LocalVariableInfoInconsistentException lviie) {
+ catch(final LocalVariableInfoInconsistentException lviie) {
throw new ClassConstraintException("Conflicting information in LocalVariableTable '"+tostring(lvt)+
"' found in Code attribute '"+tostring(obj)+
"' (method '"+tostring(m)+"'). "+lviie.getMessage(), lviie);
@@ -1130,7 +1130,7 @@ public final class Pass2Verifier extends
}// if atts[a] instanceof LocalVariableTable END
}// for all attributes atts[a] END
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -1143,21 +1143,21 @@ public final class Pass2Verifier extends
// incorrectly named, it's the Exceptions attribute (vmspec2 4.7.4)
checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
- String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
+ final String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
if (! name.equals("Exceptions")) {
throw new ClassConstraintException(
"The Exceptions attribute '"+tostring(obj)+"' is not correctly named 'Exceptions' but '"+name+"'.");
}
- int[] exc_indices = obj.getExceptionIndexTable();
+ final int[] exc_indices = obj.getExceptionIndexTable();
- for (int exc_indice : exc_indices) {
+ for (final int exc_indice : exc_indices) {
checkIndex(obj, exc_indice, CONST_Class);
- ConstantClass cc = (ConstantClass) (cp.getConstant(exc_indice));
+ final ConstantClass cc = (ConstantClass) (cp.getConstant(exc_indice));
checkIndex(cc, cc.getNameIndex(), CONST_Utf8); // can't be sure this ConstantClass has already been visited (checked)!
//convert internal notation on-the-fly to external notation:
- String cname = ((ConstantUtf8) cp.getConstant(cc.getNameIndex())).getBytes().replace('/','.');
+ final String cname = ((ConstantUtf8) cp.getConstant(cc.getNameIndex())).getBytes().replace('/','.');
Verifier v = VerifierFactory.getVerifier(cname);
VerificationResult vr = v.doPass1();
@@ -1169,8 +1169,8 @@ public final class Pass2Verifier extends
// We cannot safely trust any other "instanceof" mechanism. We need to transitively verify
// the ancestor hierarchy.
JavaClass e = Repository.lookupClass(cname);
- JavaClass t = Repository.lookupClass(Type.THROWABLE.getClassName());
- JavaClass o = Repository.lookupClass(Type.OBJECT.getClassName());
+ final JavaClass t = Repository.lookupClass(Type.THROWABLE.getClassName());
+ final JavaClass o = Repository.lookupClass(Type.OBJECT.getClassName());
while (e != o) {
if (e == t) {
break; // It's a subclass of Throwable, OKAY, leave.
@@ -1191,7 +1191,7 @@ public final class Pass2Verifier extends
}
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -1205,7 +1205,7 @@ public final class Pass2Verifier extends
public void visitLineNumberTable(final LineNumberTable obj) {//vmspec2 4.7.8
checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
- String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
+ final String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
if (! name.equals("LineNumberTable")) {
throw new ClassConstraintException("The LineNumberTable attribute '"+tostring(obj)+
"' is not correctly named 'LineNumberTable' but '"+name+"'.");
@@ -1286,11 +1286,11 @@ public final class Pass2Verifier extends
*/
private void field_and_method_refs_are_valid() {
try {
- JavaClass jc = Repository.lookupClass(myOwner.getClassName());
- DescendingVisitor v = new DescendingVisitor(jc, new FAMRAV_Visitor(jc));
+ final JavaClass jc = Repository.lookupClass(myOwner.getClassName());
+ final DescendingVisitor v = new DescendingVisitor(jc, new FAMRAV_Visitor(jc));
v.visit();
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -1316,26 +1316,26 @@ public final class Pass2Verifier extends
if (obj.getTag() != Const.CONSTANT_Fieldref) {
throw new ClassConstraintException("ConstantFieldref '"+tostring(obj)+"' has wrong tag!");
}
- int name_and_type_index = obj.getNameAndTypeIndex();
- ConstantNameAndType cnat = (ConstantNameAndType) (cp.getConstant(name_and_type_index));
- String name = ((ConstantUtf8) (cp.getConstant(cnat.getNameIndex()))).getBytes(); // Field or Method name
+ final int name_and_type_index = obj.getNameAndTypeIndex();
+ final ConstantNameAndType cnat = (ConstantNameAndType) (cp.getConstant(name_and_type_index));
+ final String name = ((ConstantUtf8) (cp.getConstant(cnat.getNameIndex()))).getBytes(); // Field or Method name
if (!validFieldName(name)) {
throw new ClassConstraintException("Invalid field name '"+name+"' referenced by '"+tostring(obj)+"'.");
}
- int class_index = obj.getClassIndex();
- ConstantClass cc = (ConstantClass) (cp.getConstant(class_index));
- String className = ((ConstantUtf8) (cp.getConstant(cc.getNameIndex()))).getBytes(); // Class Name in internal form
+ final int class_index = obj.getClassIndex();
+ final ConstantClass cc = (ConstantClass) (cp.getConstant(class_index));
+ final String className = ((ConstantUtf8) (cp.getConstant(cc.getNameIndex()))).getBytes(); // Class Name in internal form
if (! validClassName(className)) {
throw new ClassConstraintException("Illegal class name '"+className+"' used by '"+tostring(obj)+"'.");
}
- String sig = ((ConstantUtf8) (cp.getConstant(cnat.getSignatureIndex()))).getBytes(); // Field or Method sig.(=descriptor)
+ final String sig = ((ConstantUtf8) (cp.getConstant(cnat.getSignatureIndex()))).getBytes(); // Field or Method sig.(=descriptor)
try{
Type.getType(sig); /* Don't need the return value */
}
- catch (ClassFormatException cfe) {
+ catch (final ClassFormatException cfe) {
throw new ClassConstraintException("Illegal descriptor (==signature) '"+sig+"' used by '"+tostring(obj)+"'.", cfe);
}
}
@@ -1345,30 +1345,30 @@ public final class Pass2Verifier extends
if (obj.getTag() != Const.CONSTANT_Methodref) {
throw new ClassConstraintException("ConstantMethodref '"+tostring(obj)+"' has wrong tag!");
}
- int name_and_type_index = obj.getNameAndTypeIndex();
- ConstantNameAndType cnat = (ConstantNameAndType) (cp.getConstant(name_and_type_index));
- String name = ((ConstantUtf8) (cp.getConstant(cnat.getNameIndex()))).getBytes(); // Field or Method name
+ final int name_and_type_index = obj.getNameAndTypeIndex();
+ final ConstantNameAndType cnat = (ConstantNameAndType) (cp.getConstant(name_and_type_index));
+ final String name = ((ConstantUtf8) (cp.getConstant(cnat.getNameIndex()))).getBytes(); // Field or Method name
if (!validClassMethodName(name)) {
throw new ClassConstraintException(
"Invalid (non-interface) method name '"+name+"' referenced by '"+tostring(obj)+"'.");
}
- int class_index = obj.getClassIndex();
- ConstantClass cc = (ConstantClass) (cp.getConstant(class_index));
- String className = ((ConstantUtf8) (cp.getConstant(cc.getNameIndex()))).getBytes(); // Class Name in internal form
+ final int class_index = obj.getClassIndex();
+ final ConstantClass cc = (ConstantClass) (cp.getConstant(class_index));
+ final String className = ((ConstantUtf8) (cp.getConstant(cc.getNameIndex()))).getBytes(); // Class Name in internal form
if (! validClassName(className)) {
throw new ClassConstraintException("Illegal class name '"+className+"' used by '"+tostring(obj)+"'.");
}
- String sig = ((ConstantUtf8) (cp.getConstant(cnat.getSignatureIndex()))).getBytes(); // Field or Method sig.(=descriptor)
+ final String sig = ((ConstantUtf8) (cp.getConstant(cnat.getSignatureIndex()))).getBytes(); // Field or Method sig.(=descriptor)
try{
- Type t = Type.getReturnType(sig);
+ final Type t = Type.getReturnType(sig);
if ( name.equals(Const.CONSTRUCTOR_NAME) && (t != Type.VOID) ) {
throw new ClassConstraintException("Instance initialization method must have VOID return type.");
}
}
- catch (ClassFormatException cfe) {
+ catch (final ClassFormatException cfe) {
throw new ClassConstraintException("Illegal descriptor (==signature) '"+sig+"' used by '"+tostring(obj)+"'.", cfe);
}
}
@@ -1378,31 +1378,31 @@ public final class Pass2Verifier extends
if (obj.getTag() != Const.CONSTANT_InterfaceMethodref) {
throw new ClassConstraintException("ConstantInterfaceMethodref '"+tostring(obj)+"' has wrong tag!");
}
- int name_and_type_index = obj.getNameAndTypeIndex();
- ConstantNameAndType cnat = (ConstantNameAndType) (cp.getConstant(name_and_type_index));
- String name = ((ConstantUtf8) (cp.getConstant(cnat.getNameIndex()))).getBytes(); // Field or Method name
+ final int name_and_type_index = obj.getNameAndTypeIndex();
+ final ConstantNameAndType cnat = (ConstantNameAndType) (cp.getConstant(name_and_type_index));
+ final String name = ((ConstantUtf8) (cp.getConstant(cnat.getNameIndex()))).getBytes(); // Field or Method name
if (!validInterfaceMethodName(name)) {
throw new ClassConstraintException("Invalid (interface) method name '"+name+"' referenced by '"+tostring(obj)+"'.");
}
- int class_index = obj.getClassIndex();
- ConstantClass cc = (ConstantClass) (cp.getConstant(class_index));
- String className = ((ConstantUtf8) (cp.getConstant(cc.getNameIndex()))).getBytes(); // Class Name in internal form
+ final int class_index = obj.getClassIndex();
+ final ConstantClass cc = (ConstantClass) (cp.getConstant(class_index));
+ final String className = ((ConstantUtf8) (cp.getConstant(cc.getNameIndex()))).getBytes(); // Class Name in internal form
if (! validClassName(className)) {
throw new ClassConstraintException("Illegal class name '"+className+"' used by '"+tostring(obj)+"'.");
}
- String sig = ((ConstantUtf8) (cp.getConstant(cnat.getSignatureIndex()))).getBytes(); // Field or Method sig.(=descriptor)
+ final String sig = ((ConstantUtf8) (cp.getConstant(cnat.getSignatureIndex()))).getBytes(); // Field or Method sig.(=descriptor)
try{
- Type t = Type.getReturnType(sig);
+ final Type t = Type.getReturnType(sig);
if ( name.equals(Const.STATIC_INITIALIZER_NAME) && (t != Type.VOID) ) {
addMessage("Class or interface initialization method '"+Const.STATIC_INITIALIZER_NAME+
"' usually has VOID return type instead of '"+t+
"'. Note this is really not a requirement of The Java Virtual Machine Specification, Second Edition.");
}
}
- catch (ClassFormatException cfe) {
+ catch (final ClassFormatException cfe) {
throw new ClassConstraintException("Illegal descriptor (==signature) '"+sig+"' used by '"+tostring(obj)+"'.", cfe);
}
@@ -1552,9 +1552,9 @@ public final class Pass2Verifier extends
/** This method casually visits ConstantClass references. */
@Override
public void visitConstantClass(final ConstantClass obj) {
- Constant c = cp.getConstant(obj.getNameIndex());
+ final Constant c = cp.getConstant(obj.getNameIndex());
if (c instanceof ConstantUtf8) { //Ignore the case where it's not a ConstantUtf8 here, we'll find out later.
- String classname = ((ConstantUtf8) c).getBytes();
+ final String classname = ((ConstantUtf8) c).getBytes();
if (classname.startsWith(jc.getClassName().replace('.','/')+"$")) {
hasInnerClass = true;
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java?rev=1749603&r1=1749602&r2=1749603&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java Tue Jun 21 20:50:19 2016
@@ -162,12 +162,12 @@ public final class Pass3aVerifier extend
if (myOwner.doPass2().equals(VerificationResult.VR_OK)) {
// Okay, class file was loaded correctly by Pass 1
// and satisfies static constraints of Pass 2.
- JavaClass jc = Repository.lookupClass(myOwner.getClassName());
- Method[] methods = jc.getMethods();
+ final JavaClass jc = Repository.lookupClass(myOwner.getClassName());
+ final Method[] methods = jc.getMethods();
if (method_no >= methods.length) {
throw new InvalidMethodException("METHOD DOES NOT EXIST!");
}
- Method method = methods[method_no];
+ final Method method = methods[method_no];
code = method.getCode();
// No Code? Nothing to verify!
@@ -187,7 +187,7 @@ public final class Pass3aVerifier extend
try{
instructionList = new InstructionList(method.getCode().getCode());
}
- catch(RuntimeException re) {
+ catch(final RuntimeException re) {
return new VerificationResult(VerificationResult.VERIFIED_REJECTED,
"Bad bytecode in the code array of the Code attribute of method '"+method+"'.");
}
@@ -199,7 +199,7 @@ public final class Pass3aVerifier extend
try{
delayedPass2Checks();
}
- catch(ClassConstraintException cce) {
+ catch(final ClassConstraintException cce) {
vr = new VerificationResult(VerificationResult.VERIFIED_REJECTED, cce.getMessage());
return vr;
}
@@ -207,17 +207,17 @@ public final class Pass3aVerifier extend
pass3StaticInstructionChecks();
pass3StaticInstructionOperandsChecks();
}
- catch(StaticCodeConstraintException scce) {
+ catch(final StaticCodeConstraintException scce) {
vr = new VerificationResult(VerificationResult.VERIFIED_REJECTED, scce.getMessage());
}
- catch(ClassCastException cce) {
+ catch(final ClassCastException cce) {
vr = new VerificationResult(VerificationResult.VERIFIED_REJECTED, "Class Cast Exception: " + cce.getMessage());
}
return vr;
}
//did not pass Pass 2.
return VerificationResult.VR_NOTYET;
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -234,21 +234,21 @@ public final class Pass3aVerifier extend
*/
private void delayedPass2Checks() {
- int[] instructionPositions = instructionList.getInstructionPositions();
- int codeLength = code.getCode().length;
+ final int[] instructionPositions = instructionList.getInstructionPositions();
+ final int codeLength = code.getCode().length;
/////////////////////
// LineNumberTable //
/////////////////////
- LineNumberTable lnt = code.getLineNumberTable();
+ final LineNumberTable lnt = code.getLineNumberTable();
if (lnt != null) {
- LineNumber[] lineNumbers = lnt.getLineNumberTable();
- IntList offsets = new IntList();
+ final LineNumber[] lineNumbers = lnt.getLineNumberTable();
+ final IntList offsets = new IntList();
lineNumber_loop:
- for (LineNumber lineNumber : lineNumbers) { // may appear in any order.
- for (int instructionPosition : instructionPositions) {
+ for (final LineNumber lineNumber : lineNumbers) { // may appear in any order.
+ for (final int instructionPosition : instructionPositions) {
// TODO: Make this a binary search! The instructionPositions array is naturally ordered!
- int offset = lineNumber.getStartPC();
+ final int offset = lineNumber.getStartPC();
if (instructionPosition == offset) {
if (offsets.contains(offset)) {
addMessage("LineNumberTable attribute '" + code.getLineNumberTable() +
@@ -271,14 +271,14 @@ public final class Pass3aVerifier extend
///////////////////////////
/* We cannot use code.getLocalVariableTable() because there could be more
than only one. This is a bug in BCEL. */
- Attribute[] atts = code.getAttributes();
- for (Attribute att : atts) {
+ final Attribute[] atts = code.getAttributes();
+ for (final Attribute att : atts) {
if (att instanceof LocalVariableTable) {
- LocalVariableTable lvt = (LocalVariableTable) att;
- LocalVariable[] localVariables = lvt.getLocalVariableTable();
- for (LocalVariable localVariable : localVariables) {
- int startpc = localVariable.getStartPC();
- int length = localVariable.getLength();
+ final LocalVariableTable lvt = (LocalVariableTable) att;
+ final LocalVariable[] localVariables = lvt.getLocalVariableTable();
+ for (final LocalVariable localVariable : localVariables) {
+ final int startpc = localVariable.getStartPC();
+ final int length = localVariable.getLength();
if (!contains(instructionPositions, startpc)) {
throw new ClassConstraintException("Code attribute '" + code
@@ -301,11 +301,11 @@ public final class Pass3aVerifier extend
// In BCEL's "classfile" API, the startPC/endPC-notation is
// inclusive/exclusive as in the Java Virtual Machine Specification.
// WARNING: This is not true for BCEL's "generic" API.
- CodeException[] exceptionTable = code.getExceptionTable();
- for (CodeException element : exceptionTable) {
- int startpc = element.getStartPC();
- int endpc = element.getEndPC();
- int handlerpc = element.getHandlerPC();
+ final CodeException[] exceptionTable = code.getExceptionTable();
+ for (final CodeException element : exceptionTable) {
+ final int startpc = element.getStartPC();
+ final int endpc = element.getEndPC();
+ final int handlerpc = element.getHandlerPC();
if (startpc >= endpc) {
throw new ClassConstraintException("Code attribute '"+code+"' has an exception_table entry '"+element+
"' that has its start_pc ('"+startpc+"') not smaller than its end_pc ('"+endpc+"').");
@@ -362,7 +362,7 @@ public final class Pass3aVerifier extend
// We currently go the safe way here.
InstructionHandle ih = instructionList.getStart();
while (ih != null) {
- Instruction i = ih.getInstruction();
+ final Instruction i = ih.getInstruction();
if (i instanceof IMPDEP1) {
throw new StaticCodeInstructionConstraintException(
"IMPDEP1 must not be in the code, it is an illegal instruction for _internal_ JVM use!");
@@ -382,7 +382,7 @@ public final class Pass3aVerifier extend
// An unreachable last instruction may also not fall through the
// end of the code, which is stupid -- but with the original
// verifier's subroutine semantics one cannot predict reachability.
- Instruction last = instructionList.getEnd().getInstruction();
+ final Instruction last = instructionList.getEnd().getInstruction();
if (! ((last instanceof ReturnInstruction) ||
(last instanceof RET) ||
(last instanceof GotoInstruction) ||
@@ -416,17 +416,17 @@ public final class Pass3aVerifier extend
// TODO: Implement as much as possible here. BCEL does _not_ check everything.
- ConstantPoolGen cpg = new ConstantPoolGen(Repository.lookupClass(myOwner.getClassName()).getConstantPool());
- InstOperandConstraintVisitor v = new InstOperandConstraintVisitor(cpg);
+ final ConstantPoolGen cpg = new ConstantPoolGen(Repository.lookupClass(myOwner.getClassName()).getConstantPool());
+ final InstOperandConstraintVisitor v = new InstOperandConstraintVisitor(cpg);
// Checks for the things BCEL does _not_ handle itself.
InstructionHandle ih = instructionList.getStart();
while (ih != null) {
- Instruction i = ih.getInstruction();
+ final Instruction i = ih.getInstruction();
// An "own" constraint, due to JustIce's new definition of what "subroutine" means.
if (i instanceof JsrInstruction) {
- InstructionHandle target = ((JsrInstruction) i).getTarget();
+ final InstructionHandle target = ((JsrInstruction) i).getTarget();
if (target == instructionList.getStart()) {
throw new StaticCodeInstructionOperandConstraintException(
"Due to JustIce's clear definition of subroutines, no JSR or JSR_W may have a top-level instruction"+
@@ -445,7 +445,7 @@ public final class Pass3aVerifier extend
ih = ih.getNext();
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -453,7 +453,7 @@ public final class Pass3aVerifier extend
/** A small utility method returning if a given int i is in the given int[] ints. */
private static boolean contains(final int[] ints, final int i) {
- for (int k : ints) {
+ for (final int k : ints) {
if (k==i) {
return true;
}
@@ -486,7 +486,7 @@ public final class Pass3aVerifier extend
private int max_locals() {
try {
return Repository.lookupClass(myOwner.getClassName()).getMethods()[method_no].getCode().getMaxLocals();
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -518,10 +518,10 @@ public final class Pass3aVerifier extend
*/
@Override
public void visitLoadClass(final LoadClass o) {
- ObjectType t = o.getLoadClassType(cpg);
+ final ObjectType t = o.getLoadClassType(cpg);
if (t != null) {// null means "no class is loaded"
- Verifier v = VerifierFactory.getVerifier(t.getClassName());
- VerificationResult vr = v.doPass1();
+ final Verifier v = VerifierFactory.getVerifier(t.getClassName());
+ final VerificationResult vr = v.doPass1();
if (vr.getStatus() != VerificationResult.VERIFIED_OK) {
constraintViolated((Instruction) o,
"Class '"+o.getLoadClassType(cpg).getClassName()+"' is referenced, but cannot be loaded: '"+vr+"'.");
@@ -541,7 +541,7 @@ public final class Pass3aVerifier extend
@Override
public void visitLDC(final LDC o) {
indexValid(o, o.getIndex());
- Constant c = cpg.getConstant(o.getIndex());
+ final Constant c = cpg.getConstant(o.getIndex());
if (c instanceof ConstantClass) {
addMessage("Operand of LDC or LDC_W is CONSTANT_Class '"+c+"' - this is only supported in JDK 1.5 and higher.");
}
@@ -560,7 +560,7 @@ public final class Pass3aVerifier extend
@Override
public void visitLDC2_W(final LDC2_W o) {
indexValid(o, o.getIndex());
- Constant c = cpg.getConstant(o.getIndex());
+ final Constant c = cpg.getConstant(o.getIndex());
if (! ( (c instanceof ConstantLong) ||
(c instanceof ConstantDouble) ) ) {
constraintViolated(o, "Operand of LDC2_W must be CONSTANT_Long or CONSTANT_Double, but is '"+c+"'.");
@@ -568,13 +568,13 @@ public final class Pass3aVerifier extend
try{
indexValid(o, o.getIndex()+1);
}
- catch(StaticCodeInstructionOperandConstraintException e) {
+ catch(final StaticCodeInstructionOperandConstraintException e) {
throw new AssertionViolatedException("OOPS: Does not BCEL handle that? LDC2_W operand has a problem.", e);
}
}
private ObjectType getObjectType(final FieldInstruction o) {
- ReferenceType rt = o.getReferenceType(cpg);
+ final ReferenceType rt = o.getReferenceType(cpg);
if(rt instanceof ObjectType) {
return (ObjectType)rt;
}
@@ -588,20 +588,20 @@ public final class Pass3aVerifier extend
public void visitFieldInstruction(final FieldInstruction o) {
try {
indexValid(o, o.getIndex());
- Constant c = cpg.getConstant(o.getIndex());
+ final Constant c = cpg.getConstant(o.getIndex());
if (! (c instanceof ConstantFieldref)) {
constraintViolated(o, "Indexing a constant that's not a CONSTANT_Fieldref but a '"+c+"'.");
}
- String field_name = o.getFieldName(cpg);
+ final String field_name = o.getFieldName(cpg);
- JavaClass jc = Repository.lookupClass(getObjectType(o).getClassName());
+ final JavaClass jc = Repository.lookupClass(getObjectType(o).getClassName());
Field[] fields = jc.getFields();
Field f = null;
- for (Field field : fields) {
+ for (final Field field : fields) {
if (field.getName().equals(field_name)) {
- Type f_type = Type.getType(field.getSignature());
- Type o_type = o.getType(cpg);
+ final Type f_type = Type.getType(field.getSignature());
+ final Type o_type = o.getType(cpg);
/* TODO: Check if assignment compatibility is sufficient.
* What does Sun do?
*/
@@ -612,14 +612,14 @@ public final class Pass3aVerifier extend
}
}
if (f == null) {
- JavaClass[] superclasses = jc.getSuperClasses();
+ final JavaClass[] superclasses = jc.getSuperClasses();
outer:
- for (JavaClass superclass : superclasses) {
+ for (final JavaClass superclass : superclasses) {
fields = superclass.getFields();
- for (Field field : fields) {
+ for (final Field field : fields) {
if (field.getName().equals(field_name)) {
- Type f_type = Type.getType(field.getSignature());
- Type o_type = o.getType(cpg);
+ final Type f_type = Type.getType(field.getSignature());
+ final Type o_type = o.getType(cpg);
if (f_type.equals(o_type)) {
f = field;
if ((f.getAccessFlags() & (Const.ACC_PUBLIC | Const.ACC_PROTECTED)) == 0) {
@@ -651,7 +651,7 @@ public final class Pass3aVerifier extend
/* TODO: Check for access modifiers here. */
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -664,14 +664,14 @@ public final class Pass3aVerifier extend
if ( (o instanceof INVOKEVIRTUAL) ||
(o instanceof INVOKESPECIAL) ||
(o instanceof INVOKESTATIC) ) {
- Constant c = cpg.getConstant(o.getIndex());
+ final Constant c = cpg.getConstant(o.getIndex());
if (! (c instanceof ConstantMethodref)) {
constraintViolated(o, "Indexing a constant that's not a CONSTANT_Methodref but a '"+c+"'.");
}
else{
// Constants are okay due to pass2.
- ConstantNameAndType cnat = (ConstantNameAndType) (cpg.getConstant(((ConstantMethodref) c).getNameAndTypeIndex()));
- ConstantUtf8 cutf8 = (ConstantUtf8) (cpg.getConstant(cnat.getNameIndex()));
+ final ConstantNameAndType cnat = (ConstantNameAndType) (cpg.getConstant(((ConstantMethodref) c).getNameAndTypeIndex()));
+ final ConstantUtf8 cutf8 = (ConstantUtf8) (cpg.getConstant(cnat.getNameIndex()));
if (cutf8.getBytes().equals(Const.CONSTRUCTOR_NAME) && (!(o instanceof INVOKESPECIAL)) ) {
constraintViolated(o, "Only INVOKESPECIAL is allowed to invoke instance initialization methods.");
}
@@ -683,7 +683,7 @@ public final class Pass3aVerifier extend
}
}
else{ //if (o instanceof INVOKEINTERFACE) {
- Constant c = cpg.getConstant(o.getIndex());
+ final Constant c = cpg.getConstant(o.getIndex());
if (! (c instanceof ConstantInterfaceMethodref)) {
constraintViolated(o, "Indexing a constant that's not a CONSTANT_InterfaceMethodref but a '"+c+"'.");
}
@@ -693,9 +693,9 @@ public final class Pass3aVerifier extend
// By now, BCEL hides those two operands because they're superfluous.
// Invoked method must not be <init> or <clinit>
- ConstantNameAndType cnat =
+ final ConstantNameAndType cnat =
(ConstantNameAndType) (cpg.getConstant(((ConstantInterfaceMethodref)c).getNameAndTypeIndex()));
- String name = ((ConstantUtf8) (cpg.getConstant(cnat.getNameIndex()))).getBytes();
+ final String name = ((ConstantUtf8) (cpg.getConstant(cnat.getNameIndex()))).getBytes();
if (name.equals(Const.CONSTRUCTOR_NAME)) {
constraintViolated(o, "Method to invoke must not be '"+Const.CONSTRUCTOR_NAME+"'.");
}
@@ -711,22 +711,22 @@ public final class Pass3aVerifier extend
t = ((ArrayType) t).getBasicType();
}
if (t instanceof ObjectType) {
- Verifier v = VerifierFactory.getVerifier(((ObjectType) t).getClassName());
- VerificationResult vr = v.doPass2();
+ final Verifier v = VerifierFactory.getVerifier(((ObjectType) t).getClassName());
+ final VerificationResult vr = v.doPass2();
if (vr.getStatus() != VerificationResult.VERIFIED_OK) {
constraintViolated(o, "Return type class/interface could not be verified successfully: '"+vr.getMessage()+"'.");
}
}
- Type[] ts = o.getArgumentTypes(cpg);
- for (Type element : ts) {
+ final Type[] ts = o.getArgumentTypes(cpg);
+ for (final Type element : ts) {
t = element;
if (t instanceof ArrayType) {
t = ((ArrayType) t).getBasicType();
}
if (t instanceof ObjectType) {
- Verifier v = VerifierFactory.getVerifier(((ObjectType) t).getClassName());
- VerificationResult vr = v.doPass2();
+ final Verifier v = VerifierFactory.getVerifier(((ObjectType) t).getClassName());
+ final VerificationResult vr = v.doPass2();
if (vr.getStatus() != VerificationResult.VERIFIED_OK) {
constraintViolated(o,
"Argument type class/interface could not be verified successfully: '"+vr.getMessage()+"'.");
@@ -740,7 +740,7 @@ public final class Pass3aVerifier extend
@Override
public void visitINSTANCEOF(final INSTANCEOF o) {
indexValid(o, o.getIndex());
- Constant c = cpg.getConstant(o.getIndex());
+ final Constant c = cpg.getConstant(o.getIndex());
if (! (c instanceof ConstantClass)) {
constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'.");
}
@@ -750,7 +750,7 @@ public final class Pass3aVerifier extend
@Override
public void visitCHECKCAST(final CHECKCAST o) {
indexValid(o, o.getIndex());
- Constant c = cpg.getConstant(o.getIndex());
+ final Constant c = cpg.getConstant(o.getIndex());
if (! (c instanceof ConstantClass)) {
constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'.");
}
@@ -760,13 +760,13 @@ public final class Pass3aVerifier extend
@Override
public void visitNEW(final NEW o) {
indexValid(o, o.getIndex());
- Constant c = cpg.getConstant(o.getIndex());
+ final Constant c = cpg.getConstant(o.getIndex());
if (! (c instanceof ConstantClass)) {
constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'.");
}
else{
- ConstantUtf8 cutf8 = (ConstantUtf8) (cpg.getConstant( ((ConstantClass) c).getNameIndex() ));
- Type t = Type.getType("L"+cutf8.getBytes()+";");
+ final ConstantUtf8 cutf8 = (ConstantUtf8) (cpg.getConstant( ((ConstantClass) c).getNameIndex() ));
+ final Type t = Type.getType("L"+cutf8.getBytes()+";");
if (t instanceof ArrayType) {
constraintViolated(o, "NEW must not be used to create an array.");
}
@@ -778,17 +778,17 @@ public final class Pass3aVerifier extend
@Override
public void visitMULTIANEWARRAY(final MULTIANEWARRAY o) {
indexValid(o, o.getIndex());
- Constant c = cpg.getConstant(o.getIndex());
+ final Constant c = cpg.getConstant(o.getIndex());
if (! (c instanceof ConstantClass)) {
constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'.");
}
- int dimensions2create = o.getDimensions();
+ final int dimensions2create = o.getDimensions();
if (dimensions2create < 1) {
constraintViolated(o, "Number of dimensions to create must be greater than zero.");
}
- Type t = o.getType(cpg);
+ final Type t = o.getType(cpg);
if (t instanceof ArrayType) {
- int dimensions = ((ArrayType) t).getDimensions();
+ final int dimensions = ((ArrayType) t).getDimensions();
if (dimensions < dimensions2create) {
constraintViolated(o,
"Not allowed to create array with more dimensions ('"+dimensions2create+
@@ -805,13 +805,13 @@ public final class Pass3aVerifier extend
@Override
public void visitANEWARRAY(final ANEWARRAY o) {
indexValid(o, o.getIndex());
- Constant c = cpg.getConstant(o.getIndex());
+ final Constant c = cpg.getConstant(o.getIndex());
if (! (c instanceof ConstantClass)) {
constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'.");
}
- Type t = o.getType(cpg);
+ final Type t = o.getType(cpg);
if (t instanceof ArrayType) {
- int dimensions = ((ArrayType) t).getDimensions();
+ final int dimensions = ((ArrayType) t).getDimensions();
if (dimensions > Const.MAX_ARRAY_DIMENSIONS) {
constraintViolated(o,
"Not allowed to create an array with more than "+ Const.MAX_ARRAY_DIMENSIONS + " dimensions;"+
@@ -823,7 +823,7 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitNEWARRAY(final NEWARRAY o) {
- byte t = o.getTypecode();
+ final byte t = o.getTypecode();
if (! ( (t == Const.T_BOOLEAN) ||
(t == Const.T_CHAR) ||
(t == Const.T_FLOAT) ||
@@ -839,12 +839,12 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitILOAD(final ILOAD o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative.");
}
else{
- int maxminus1 = max_locals()-1;
+ final int maxminus1 = max_locals()-1;
if (idx > maxminus1) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-1 '"+maxminus1+"'.");
}
@@ -854,12 +854,12 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitFLOAD(final FLOAD o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative.");
}
else{
- int maxminus1 = max_locals()-1;
+ final int maxminus1 = max_locals()-1;
if (idx > maxminus1) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-1 '"+maxminus1+"'.");
}
@@ -869,12 +869,12 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitALOAD(final ALOAD o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative.");
}
else{
- int maxminus1 = max_locals()-1;
+ final int maxminus1 = max_locals()-1;
if (idx > maxminus1) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-1 '"+maxminus1+"'.");
}
@@ -884,12 +884,12 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitISTORE(final ISTORE o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative.");
}
else{
- int maxminus1 = max_locals()-1;
+ final int maxminus1 = max_locals()-1;
if (idx > maxminus1) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-1 '"+maxminus1+"'.");
}
@@ -899,12 +899,12 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitFSTORE(final FSTORE o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative.");
}
else{
- int maxminus1 = max_locals()-1;
+ final int maxminus1 = max_locals()-1;
if (idx > maxminus1) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-1 '"+maxminus1+"'.");
}
@@ -914,12 +914,12 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitASTORE(final ASTORE o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative.");
}
else{
- int maxminus1 = max_locals()-1;
+ final int maxminus1 = max_locals()-1;
if (idx > maxminus1) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-1 '"+maxminus1+"'.");
}
@@ -929,12 +929,12 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitIINC(final IINC o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative.");
}
else{
- int maxminus1 = max_locals()-1;
+ final int maxminus1 = max_locals()-1;
if (idx > maxminus1) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-1 '"+maxminus1+"'.");
}
@@ -944,12 +944,12 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitRET(final RET o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative.");
}
else{
- int maxminus1 = max_locals()-1;
+ final int maxminus1 = max_locals()-1;
if (idx > maxminus1) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-1 '"+maxminus1+"'.");
}
@@ -959,13 +959,13 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitLLOAD(final LLOAD o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative."+
" [Constraint by JustIce as an analogon to the single-slot xLOAD/xSTORE instructions; may not happen anyway.]");
}
else{
- int maxminus2 = max_locals()-2;
+ final int maxminus2 = max_locals()-2;
if (idx > maxminus2) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-2 '"+maxminus2+"'.");
}
@@ -975,13 +975,13 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitDLOAD(final DLOAD o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative."+
" [Constraint by JustIce as an analogon to the single-slot xLOAD/xSTORE instructions; may not happen anyway.]");
}
else{
- int maxminus2 = max_locals()-2;
+ final int maxminus2 = max_locals()-2;
if (idx > maxminus2) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-2 '"+maxminus2+"'.");
}
@@ -991,13 +991,13 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitLSTORE(final LSTORE o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative."+
" [Constraint by JustIce as an analogon to the single-slot xLOAD/xSTORE instructions; may not happen anyway.]");
}
else{
- int maxminus2 = max_locals()-2;
+ final int maxminus2 = max_locals()-2;
if (idx > maxminus2) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-2 '"+maxminus2+"'.");
}
@@ -1007,13 +1007,13 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitDSTORE(final DSTORE o) {
- int idx = o.getIndex();
+ final int idx = o.getIndex();
if (idx < 0) {
constraintViolated(o, "Index '"+idx+"' must be non-negative."+
" [Constraint by JustIce as an analogon to the single-slot xLOAD/xSTORE instructions; may not happen anyway.]");
}
else{
- int maxminus2 = max_locals()-2;
+ final int maxminus2 = max_locals()-2;
if (idx > maxminus2) {
constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-2 '"+maxminus2+"'.");
}
@@ -1023,7 +1023,7 @@ public final class Pass3aVerifier extend
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitLOOKUPSWITCH(final LOOKUPSWITCH o) {
- int[] matchs = o.getMatchs();
+ final int[] matchs = o.getMatchs();
int max = Integer.MIN_VALUE;
for (int i=0; i<matchs.length; i++) {
if (matchs[i] == max && i != 0) {
@@ -1049,11 +1049,11 @@ public final class Pass3aVerifier extend
@Override
public void visitPUTSTATIC(final PUTSTATIC o) {
try {
- String field_name = o.getFieldName(cpg);
- JavaClass jc = Repository.lookupClass(getObjectType(o).getClassName());
- Field[] fields = jc.getFields();
+ final String field_name = o.getFieldName(cpg);
+ final JavaClass jc = Repository.lookupClass(getObjectType(o).getClassName());
+ final Field[] fields = jc.getFields();
Field f = null;
- for (Field field : fields) {
+ for (final Field field : fields) {
if (field.getName().equals(field_name)) {
f = field;
break;
@@ -1075,13 +1075,13 @@ public final class Pass3aVerifier extend
constraintViolated(o, "Referenced field '"+f+"' is not static which it should be.");
}
- String meth_name = Repository.lookupClass(myOwner.getClassName()).getMethods()[method_no].getName();
+ final String meth_name = Repository.lookupClass(myOwner.getClassName()).getMethods()[method_no].getName();
// If it's an interface, it can be set only in <clinit>.
if ((!(jc.isClass())) && (!(meth_name.equals(Const.STATIC_INITIALIZER_NAME)))) {
constraintViolated(o, "Interface field '"+f+"' must be set in a '"+Const.STATIC_INITIALIZER_NAME+"' method.");
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -1091,11 +1091,11 @@ public final class Pass3aVerifier extend
@Override
public void visitGETSTATIC(final GETSTATIC o) {
try {
- String field_name = o.getFieldName(cpg);
- JavaClass jc = Repository.lookupClass(getObjectType(o).getClassName());
- Field[] fields = jc.getFields();
+ final String field_name = o.getFieldName(cpg);
+ final JavaClass jc = Repository.lookupClass(getObjectType(o).getClassName());
+ final Field[] fields = jc.getFields();
Field f = null;
- for (Field field : fields) {
+ for (final Field field : fields) {
if (field.getName().equals(field_name)) {
f = field;
break;
@@ -1108,7 +1108,7 @@ public final class Pass3aVerifier extend
if (! (f.isStatic())) {
constraintViolated(o, "Referenced field '"+f+"' is not static which it should be.");
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -1138,9 +1138,9 @@ public final class Pass3aVerifier extend
// is therefore resolved/verified.
// INVOKEINTERFACE is an InvokeInstruction, the argument and return types are resolved/verified,
// too. So are the allowed method names.
- String classname = o.getClassName(cpg);
- JavaClass jc = Repository.lookupClass(classname);
- Method m = getMethodRecursive(jc, o);
+ final String classname = o.getClassName(cpg);
+ final JavaClass jc = Repository.lookupClass(classname);
+ final Method m = getMethodRecursive(jc, o);
if (m == null) {
constraintViolated(o, "Referenced method '"+o.getMethodName(cpg)+"' with expected signature '"+o.getSignature(cpg)+
"' not found in class '"+jc.getClassName()+"'.");
@@ -1148,7 +1148,7 @@ public final class Pass3aVerifier extend
if (jc.isClass()) {
constraintViolated(o, "Referenced class '"+jc.getClassName()+"' is a class, but not an interface as expected.");
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -1170,7 +1170,7 @@ public final class Pass3aVerifier extend
return m;
}
//method not found, look in super classes
- for (JavaClass superclass : jc.getSuperClasses()) {
+ for (final JavaClass superclass : jc.getSuperClasses()) {
m = getMethod(superclass, invoke);
if(m != null) {
//method found in super class
@@ -1178,7 +1178,7 @@ public final class Pass3aVerifier extend
}
}
//method not found, look in super interfaces
- for (JavaClass superclass : jc.getInterfaces()) {
+ for (final JavaClass superclass : jc.getInterfaces()) {
m = getMethod(superclass, invoke);
if(m != null) {
//method found in super interface
@@ -1195,8 +1195,8 @@ public final class Pass3aVerifier extend
* @return the referenced method or null if not found.
*/
private Method getMethod(final JavaClass jc, final InvokeInstruction invoke) {
- Method[] ms = jc.getMethods();
- for (Method element : ms) {
+ final Method[] ms = jc.getMethods();
+ for (final Method element : ms) {
if ( (element.getName().equals(invoke.getMethodName(cpg))) &&
(Type.getReturnType(element.getSignature()).equals(invoke.getReturnType(cpg))) &&
(objarrayequals(Type.getArgumentTypes(element.getSignature()), invoke.getArgumentTypes(cpg))) ) {
@@ -1215,9 +1215,9 @@ public final class Pass3aVerifier extend
// is therefore resolved/verified.
// INVOKESPECIAL is an InvokeInstruction, the argument and return types are resolved/verified,
// too. So are the allowed method names.
- String classname = o.getClassName(cpg);
- JavaClass jc = Repository.lookupClass(classname);
- Method m = getMethodRecursive(jc, o);
+ final String classname = o.getClassName(cpg);
+ final JavaClass jc = Repository.lookupClass(classname);
+ final Method m = getMethodRecursive(jc, o);
if (m == null) {
constraintViolated(o, "Referenced method '"+o.getMethodName(cpg)+"' with expected signature '"+o.getSignature(cpg)
+"' not found in class '"+jc.getClassName()+"'.");
@@ -1238,8 +1238,8 @@ public final class Pass3aVerifier extend
supidx = current.getSuperclassNameIndex();
current = Repository.lookupClass(current.getSuperclassName());
- Method[] meths = current.getMethods();
- for (Method meth2 : meths) {
+ final Method[] meths = current.getMethods();
+ for (final Method meth2 : meths) {
if ( (meth2.getName().equals(o.getMethodName(cpg))) &&
(Type.getReturnType(meth2.getSignature()).equals(o.getReturnType(cpg))) &&
(objarrayequals(Type.getArgumentTypes(meth2.getSignature()), o.getArgumentTypes(cpg))) ) {
@@ -1259,7 +1259,7 @@ public final class Pass3aVerifier extend
}
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -1274,9 +1274,9 @@ public final class Pass3aVerifier extend
// is therefore resolved/verified.
// INVOKESTATIC is an InvokeInstruction, the argument and return types are resolved/verified,
// too. So are the allowed method names.
- String classname = o.getClassName(cpg);
- JavaClass jc = Repository.lookupClass(classname);
- Method m = getMethodRecursive(jc, o);
+ final String classname = o.getClassName(cpg);
+ final JavaClass jc = Repository.lookupClass(classname);
+ final Method m = getMethodRecursive(jc, o);
if (m == null) {
constraintViolated(o, "Referenced method '"+o.getMethodName(cpg)+"' with expected signature '"+
o.getSignature(cpg) +"' not found in class '"+jc.getClassName()+"'.");
@@ -1284,7 +1284,7 @@ public final class Pass3aVerifier extend
constraintViolated(o, "Referenced method '"+o.getMethodName(cpg)+"' has ACC_STATIC unset.");
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
throw new AssertionViolatedException("Missing class: " + e, e);
}
@@ -1299,9 +1299,9 @@ public final class Pass3aVerifier extend
// is therefore resolved/verified.
// INVOKEVIRTUAL is an InvokeInstruction, the argument and return types are resolved/verified,
// too. So are the allowed method names.
- String classname = o.getClassName(cpg);
- JavaClass jc = Repository.lookupClass(classname);
- Method m = getMethodRecursive(jc, o);
+ final String classname = o.getClassName(cpg);
+ final JavaClass jc = Repository.lookupClass(classname);
+ final Method m = getMethodRecursive(jc, o);
if (m == null) {
constraintViolated(o, "Referenced method '"+o.getMethodName(cpg)+"' with expected signature '"+
o.getSignature(cpg)+"' not found in class '"+jc.getClassName()+"'.");
@@ -1310,7 +1310,7 @@ public final class Pass3aVerifier extend
constraintViolated(o, "Referenced class '"+jc.getClassName()+"' is an interface, but not a class as expected.");
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
throw new AssertionViolatedException("Missing class: " + e, e);
}