You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by en...@apache.org on 2002/06/13 11:32:51 UTC

cvs commit: jakarta-bcel/src/java/org/apache/bcel/verifier/statics LocalVariableInfo.java LocalVariablesInfo.java Pass1Verifier.java Pass2Verifier.java Pass3aVerifier.java

enver       2002/06/13 02:32:51

  Modified:    src/java/org/apache/bcel Repository.java
               src/java/org/apache/bcel/util ClassLoader.java
               src/java/org/apache/bcel/verifier VerificationResult.java
                        Verifier.java VerifierAppFrame.java
               src/java/org/apache/bcel/verifier/exc
                        ClassConstraintException.java
                        InvalidMethodException.java LoadingException.java
               src/java/org/apache/bcel/verifier/statics
                        LocalVariableInfo.java LocalVariablesInfo.java
                        Pass1Verifier.java Pass2Verifier.java
                        Pass3aVerifier.java
  Log:
  * Cleaned up the verifier (and some other) classes so that IntelliJ's
    IDEA and also (I suppose) JTest will not complain any more.
  
  Revision  Changes    Path
  1.9       +5 -3      jakarta-bcel/src/java/org/apache/bcel/Repository.java
  
  Index: Repository.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/Repository.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Repository.java	6 Jun 2002 11:31:17 -0000	1.8
  +++ Repository.java	13 Jun 2002 09:32:50 -0000	1.9
  @@ -58,7 +58,7 @@
   import org.apache.bcel.util.*;
   import java.io.*;
   
  -/** 
  +/**
    * The repository maintains informations about class interdependencies, e.g.,
    * whether a class is a sub-class of another. Delegates actual class loading
    * to SyntheticRepository.
  @@ -130,9 +130,11 @@
       _repository.removeClass(clazz);
     }
   
  +  /*
     private static final JavaClass getSuperClass(JavaClass clazz) {
       return clazz.getSuperClass();
     }
  +  */
   
     /**
      * @return list of super classes of clazz in ascending order, i.e.,
  @@ -183,7 +185,7 @@
     public static boolean instanceOf(String clazz, String super_class) {
       return instanceOf(lookupClass(clazz), lookupClass(super_class));
     }
  -    
  +
     /**
      * @return true, if clazz is an instance of super_class
      */
  
  
  
  1.6       +1 -3      jakarta-bcel/src/java/org/apache/bcel/util/ClassLoader.java
  
  Index: ClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/util/ClassLoader.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ClassLoader.java	6 Jun 2002 11:33:20 -0000	1.5
  +++ ClassLoader.java	13 Jun 2002 09:32:50 -0000	1.6
  @@ -56,10 +56,8 @@
   
   import java.util.Hashtable;
   import java.io.*;
  -import java.util.zip.*;
   import org.apache.bcel.*;
   import org.apache.bcel.classfile.*;
  -import org.apache.bcel.generic.*;
   
   /**
    * <p>Drop in replacement for the standard class loader of the JVM. You can use it
  
  
  
  1.2       +1 -4      jakarta-bcel/src/java/org/apache/bcel/verifier/VerificationResult.java
  
  Index: VerificationResult.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/VerificationResult.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- VerificationResult.java	29 Oct 2001 20:00:31 -0000	1.1
  +++ VerificationResult.java	13 Jun 2002 09:32:50 -0000	1.2
  @@ -96,9 +96,6 @@
   	/** The detailed message. */
   	private String detailMessage;
   
  -	/** This class is not no-args instantiable. */
  -	private VerificationResult(){}
  -
   	/** The usual constructor. */
   	public VerificationResult(int status, String message){
   		numeric = status;
  
  
  
  1.5       +10 -20    jakarta-bcel/src/java/org/apache/bcel/verifier/Verifier.java
  
  Index: Verifier.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/Verifier.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Verifier.java	8 May 2002 20:59:29 -0000	1.4
  +++ Verifier.java	13 Jun 2002 09:32:50 -0000	1.5
  @@ -56,12 +56,8 @@
   
   import org.apache.bcel.*;
   import org.apache.bcel.classfile.*;
  -import org.apache.bcel.generic.*;
  -import org.apache.bcel.util.*;
   import org.apache.bcel.verifier.statics.*;
   import org.apache.bcel.verifier.structurals.*;
  -import org.apache.bcel.verifier.exc.*;
  -import org.apache.bcel.verifier.exc.Utility; // Ambigous if not declared explicitely.
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -76,7 +72,7 @@
    *
    * A Verifier creates PassVerifier instances to perform the actual verification.
    * Verifier instances are usually generated by the VerifierFactory.
  - * 
  + *
    * @version $Id$
    * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A>
    * @see org.apache.bcel.verifier.VerifierFactory
  @@ -112,7 +108,7 @@
   		}
   		return p2v.verify();
   	}
  -		
  +
   	/** Returns the VerificationResult for the given pass. */
   	public VerificationResult doPass3a(int method_no){
   		String key = Integer.toString(method_no);
  @@ -136,13 +132,7 @@
   		}
   		return p3bv.verify();
   	}
  -	
  -	/**
  -	 * This class may not be no-args instantiated.
  -	 */
  -	private Verifier(){
  -		classname = ""; // never executed anyway, make compiler happy.
  -	}// not noargs-instantiable
  +
   
   	/**
   	 * Instantiation is done by the VerifierFactory.
  @@ -230,7 +220,7 @@
   		for (int i=0; i< messages.size(); i++){
   			ret[i] = (String) messages.get(i);
   		}
  -		
  +
   		return ret;
   	}
   
  @@ -252,14 +242,14 @@
   				int dotclasspos = args[k].lastIndexOf(".class");
   				if (dotclasspos != -1) args[k] = args[k].substring(0,dotclasspos);
   			}
  -		
  +
   			args[k] = args[k].replace('/', '.');
  -		
  +
   			System.out.println("Now verifiying: "+args[k]+"\n");
   
   			Verifier v = VerifierFactory.getVerifier(args[k]);
   			VerificationResult vr;
  -		
  +
   			vr = v.doPass1();
   			System.out.println("Pass 1:\n"+vr);
   
  @@ -277,7 +267,7 @@
   					System.out.println("Pass 3b, method number "+i+" ['"+jc.getMethods()[i]+"']:\n"+vr);
   				}
   			}
  -		
  +
   			System.out.println("Warnings:");
   			String[] warnings = v.getMessages();
   			if (warnings.length == 0) System.out.println("<none>");
  @@ -286,7 +276,7 @@
   			}
   
   			System.out.println("\n");
  -	  
  +
   			// avoid swapping.
   	  	v.flush();
   	  	org.apache.bcel.Repository.clearCache();
  
  
  
  1.3       +3 -1      jakarta-bcel/src/java/org/apache/bcel/verifier/VerifierAppFrame.java
  
  Index: VerifierAppFrame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/VerifierAppFrame.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- VerifierAppFrame.java	7 Feb 2002 23:12:59 -0000	1.2
  +++ VerifierAppFrame.java	13 Jun 2002 09:32:50 -0000	1.3
  @@ -291,10 +291,12 @@
             pass2TextPane.setBackground(Color.green);
   
             JavaClass jc = Repository.lookupClass(current_class);
  +          /*
             boolean all3aok = true;
             boolean all3bok = true;
             String all3amsg = "";
             String all3bmsg = "";
  +          */
   
             String[] methodnames = new String[jc.getMethods().length];
             for (int i=0; i<jc.getMethods().length; i++){
  
  
  
  1.2       +1 -5      jakarta-bcel/src/java/org/apache/bcel/verifier/exc/ClassConstraintException.java
  
  Index: ClassConstraintException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/exc/ClassConstraintException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClassConstraintException.java	29 Oct 2001 20:00:33 -0000	1.1
  +++ ClassConstraintException.java	13 Jun 2002 09:32:50 -0000	1.2
  @@ -63,9 +63,6 @@
    * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A>
    */
   public class ClassConstraintException extends VerificationException{
  -	/** The specified error message. */
  -	private String detailMessage;
  -
   	/**
   	 * Constructs a new ClassConstraintException with null as its error message string.
   	 */
  @@ -78,6 +75,5 @@
   	 */
   	public ClassConstraintException(String message){
   		super (message);
  -		detailMessage = message;
   	}
   }
  
  
  
  1.2       +1 -3      jakarta-bcel/src/java/org/apache/bcel/verifier/exc/InvalidMethodException.java
  
  Index: InvalidMethodException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/exc/InvalidMethodException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InvalidMethodException.java	29 Oct 2001 20:00:33 -0000	1.1
  +++ InvalidMethodException.java	13 Jun 2002 09:32:50 -0000	1.2
  @@ -61,8 +61,6 @@
    * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A>
    */
   public class InvalidMethodException extends RuntimeException{
  -	/** Must not be no-args requested so there's always some error message. */
  -	private InvalidMethodException(){}
   	
   	/** Constructs an InvalidMethodException with the specified detail message. */
   	public InvalidMethodException(String message){
  
  
  
  1.2       +2 -5      jakarta-bcel/src/java/org/apache/bcel/verifier/exc/LoadingException.java
  
  Index: LoadingException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/exc/LoadingException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LoadingException.java	29 Oct 2001 20:00:33 -0000	1.1
  +++ LoadingException.java	13 Jun 2002 09:32:50 -0000	1.2
  @@ -62,9 +62,7 @@
    * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A>
    */
   public class LoadingException extends VerifierConstraintViolatedException{
  -	/** The specified error message. */
  -	private String detailMessage;
  -   
  +
   	/**
   	 * Constructs a new LoadingException with null as its error message string.
   	 */
  @@ -77,6 +75,5 @@
   	 */
   	public LoadingException(String message){
   		super (message);
  -		detailMessage = message;
   	}
   }
  
  
  
  1.2       +1 -2      jakarta-bcel/src/java/org/apache/bcel/verifier/statics/LocalVariableInfo.java
  
  Index: LocalVariableInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/statics/LocalVariableInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LocalVariableInfo.java	29 Oct 2001 20:00:34 -0000	1.1
  +++ LocalVariableInfo.java	13 Jun 2002 09:32:50 -0000	1.2
  @@ -54,7 +54,6 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.bcel.Constants;
   import org.apache.bcel.generic.Type;
   import org.apache.bcel.verifier.exc.*;
   import java.util.Hashtable;
  
  
  
  1.2       +1 -8      jakarta-bcel/src/java/org/apache/bcel/verifier/statics/LocalVariablesInfo.java
  
  Index: LocalVariablesInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/statics/LocalVariablesInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LocalVariablesInfo.java	29 Oct 2001 20:00:34 -0000	1.1
  +++ LocalVariablesInfo.java	13 Jun 2002 09:32:50 -0000	1.2
  @@ -54,7 +54,6 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.bcel.Constants;
   import org.apache.bcel.generic.Type;
   import org.apache.bcel.verifier.exc.*;
   
  @@ -71,12 +70,6 @@
   	/** The information about the local variables is stored here. */
   	private LocalVariableInfo[] localVariableInfos;
   
  -	/**
  -	 * The ints in the list represent code offsets where either instructions must start
  -	 * or the offset is the length of the code array. This will be verified in Pass 3a.
  -	 */
  -	private IntList instruction_offsets = new IntList();
  -	
   	/** The constructor. */
   	LocalVariablesInfo(int max_locals){
   		localVariableInfos = new LocalVariableInfo[max_locals];
  
  
  
  1.2       +1 -2      jakarta-bcel/src/java/org/apache/bcel/verifier/statics/Pass1Verifier.java
  
  Index: Pass1Verifier.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/statics/Pass1Verifier.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Pass1Verifier.java	29 Oct 2001 20:00:35 -0000	1.1
  +++ Pass1Verifier.java	13 Jun 2002 09:32:50 -0000	1.2
  @@ -59,7 +59,6 @@
   import org.apache.bcel.verifier.*;
   import org.apache.bcel.verifier.exc.*;
   import org.apache.bcel.verifier.exc.Utility;
  -import java.util.ArrayList;
   
   /**
    * This PassVerifier verifies a class file according to pass 1 as
  
  
  
  1.2       +53 -52    jakarta-bcel/src/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
  
  Index: Pass2Verifier.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/statics/Pass2Verifier.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Pass2Verifier.java	29 Oct 2001 20:00:36 -0000	1.1
  +++ Pass2Verifier.java	13 Jun 2002 09:32:50 -0000	1.2
  @@ -227,7 +227,6 @@
   		while (supidx != 0){
   			supidx = jc.getSuperclassNameIndex();
   
  -			ConstantPoolGen cpg = new ConstantPoolGen(jc.getConstantPool());
   			Method[] methods = jc.getMethods();
   			for (int i=0; i<methods.length; i++){
   				String name_and_sig = (methods[i].getName()+methods[i].getSignature());
  @@ -277,9 +276,11 @@
   	 */
   	private class CPESSC_Visitor extends org.apache.bcel.classfile.EmptyVisitor implements Visitor{
   		private Class CONST_Class;
  -		private Class CONST_Fieldref;
  +		/*
  +        private Class CONST_Fieldref;
   		private Class CONST_Methodref;
   		private Class CONST_InterfaceMethodref;
  +        */
   		private Class CONST_String;
   		private Class CONST_Integer;
   		private Class CONST_Float;
  @@ -296,16 +297,18 @@
   		private HashSet field_names = new HashSet();
   		private HashSet field_names_and_desc = new HashSet();
   		private HashSet method_names_and_desc = new HashSet();
  -		
  +
   		private CPESSC_Visitor(JavaClass _jc){
   			jc = _jc;
   			cp = _jc.getConstantPool();
   			cplen = cp.getLength();
  -			
  +
   			CONST_Class = org.apache.bcel.classfile.ConstantClass.class;
  -			CONST_Fieldref = org.apache.bcel.classfile.ConstantFieldref.class;
  +			/*
  +            CONST_Fieldref = org.apache.bcel.classfile.ConstantFieldref.class;
   			CONST_Methodref = org.apache.bcel.classfile.ConstantMethodref.class;
   			CONST_InterfaceMethodref = org.apache.bcel.classfile.ConstantInterfaceMethodref.class;
  +            */
   			CONST_String = org.apache.bcel.classfile.ConstantString.class;
   			CONST_Integer = org.apache.bcel.classfile.ConstantInteger.class;
   			CONST_Float = org.apache.bcel.classfile.ConstantFloat.class;
  @@ -313,18 +316,18 @@
   			CONST_Double = org.apache.bcel.classfile.ConstantDouble.class;
   			CONST_NameAndType = org.apache.bcel.classfile.ConstantNameAndType.class;
   			CONST_Utf8 = org.apache.bcel.classfile.ConstantUtf8.class;
  -		
  +
   			carrier = new DescendingVisitor(_jc, this);
   			carrier.visit();
   		}
  -		
  +
   		private void checkIndex(Node referrer, int index, Class shouldbe){
   			if ((index < 0) || (index >= cplen)){
   				throw new ClassConstraintException("Invalid index '"+index+"' used by '"+tostring(referrer)+"'.");
   			}
   			Constant c = cp.getConstant(index);
   			if (! shouldbe.isInstance(c)){
  -				String isnot = shouldbe.toString().substring(shouldbe.toString().lastIndexOf(".")+1); //Cut all before last "."
  +				/* String isnot = shouldbe.toString().substring(shouldbe.toString().lastIndexOf(".")+1); //Cut all before last "." */
   				throw new ClassCastException("Illegal constant '"+tostring(c)+"' at index '"+index+"'. '"+tostring(referrer)+"' expects a '"+shouldbe+"'.");
   			}
   		}
  @@ -335,11 +338,11 @@
   			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();
  -			
  +
   			for (int i=0; i<atts.length; i++){
   				if ((! (atts[i] instanceof SourceFile)) &&
   				    (! (atts[i] instanceof Deprecated))     &&
  @@ -347,12 +350,12 @@
   				    (! (atts[i] instanceof Synthetic))){
   					addMessage("Attribute '"+tostring(atts[i])+"' as an attribute of the ClassFile structure '"+tostring(obj)+"' is unknown and will therefore be ignored.");
   				}
  -				
  +
   				if (atts[i] instanceof SourceFile){
   					if (foundSourceFile == false) foundSourceFile = true;
   					else throw new ClassConstraintException("A ClassFile structure (like '"+tostring(obj)+"') may have no more than one SourceFile attribute."); //vmspec2 4.7.7
   				}
  -			
  +
   				if (atts[i] instanceof InnerClasses){
   					if (foundInnerClasses == false) foundInnerClasses = true;
   					else{
  @@ -372,7 +375,7 @@
   				//don't check it and javac doesn't satisfy it when it comes to anonymous
   				//inner classes
   				addMessage("A Classfile structure (like '"+tostring(obj)+"') must have exactly one InnerClasses attribute if at least one Inner Class is referenced (which is the case). No InnerClasses attribute was found.");
  -			}	
  +			}
   		}
   		/////////////////////////////
   		// CONSTANTS (vmspec2 4.4) //
  @@ -382,7 +385,7 @@
   				throw new ClassConstraintException("Wrong constant tag in '"+tostring(obj)+"'.");
   			}
   			checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
  -		
  +
   		}
   		public void visitConstantFieldref(ConstantFieldref obj){
   			if (obj.getTag() != Constants.CONSTANT_Fieldref){
  @@ -462,7 +465,7 @@
   				if (maxone > 1){
   					throw new ClassConstraintException("Field '"+tostring(obj)+"' must only have at most one of its ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC modifiers set.");
   				}
  -			
  +
   				if (obj.isFinal() && obj.isVolatile()){
   					throw new ClassConstraintException("Field '"+tostring(obj)+"' must only have at most one of its ACC_FINAL, ACC_VOLATILE modifiers set.");
   				}
  @@ -484,7 +487,7 @@
   			}
   
   			checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
  -			
  +
   			String name = obj.getName();
   			if (! validFieldName(name)){
   				throw new ClassConstraintException("Field '"+tostring(obj)+"' has illegal name '"+obj.getName()+"'.");
  @@ -492,16 +495,16 @@
   
   			// 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 signature(=descriptor)
   
   			try{
  -				Type t = Type.getType(sig);
  +				Type.getType(sig);  /* Don't need the return value */
   			}
   			catch (ClassFormatError cfe){ // sometimes BCEL is a little harsh describing exceptional situations.
   				throw new ClassConstraintException("Illegal descriptor (==signature) '"+sig+"' used by '"+tostring(obj)+"'.");
   			}
  -			
  +
   			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!");
  @@ -511,7 +514,7 @@
   			}
   			field_names_and_desc.add(nameanddesc);
   			field_names.add(name);
  -			
  +
   			Attribute[] atts = obj.getAttributes();
   			for (int i=0; i<atts.length; i++){
   				if ((! (atts[i] instanceof ConstantValue)) &&
  @@ -530,7 +533,7 @@
   		public void visitMethod(Method obj){
   
   			checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
  -			
  +
   			String name = obj.getName();
   			if (! validMethodName(name, true)){
   				throw new ClassConstraintException("Method '"+tostring(obj)+"' has illegal name '"+name+"'.");
  @@ -540,7 +543,7 @@
   			checkIndex(obj, obj.getSignatureIndex(), CONST_Utf8);
   
   			String sig  = ((ConstantUtf8) (cp.getConstant(obj.getSignatureIndex()))).getBytes(); // Method's signature(=descriptor)
  -	
  +
   			Type t;
   			Type[] ts; // needed below the try block.
   			try{
  @@ -562,7 +565,7 @@
   					throw new ClassConstraintException("Method '"+tostring(obj)+"' has a return type that does not pass verification pass 1: '"+vr+"'.");
   				}
   			}
  -			
  +
   			for (int i=0; i<ts.length; i++){
   				act = ts[i];
   				if (act instanceof ArrayType) act = ((ArrayType) act).getBasicType();
  @@ -588,7 +591,7 @@
   				if (maxone > 1){
   					throw new ClassConstraintException("Method '"+tostring(obj)+"' must only have at most one of its ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC modifiers set.");
   				}
  -			
  +
   				if (obj.isAbstract()){
   					if (obj.isFinal()) throw new ClassConstraintException("Abstract method '"+tostring(obj)+"' must not have the ACC_FINAL modifier set.");
   					if (obj.isNative()) throw new ClassConstraintException("Abstract method '"+tostring(obj)+"' must not have the ACC_NATIVE modifier set.");
  @@ -681,14 +684,14 @@
   			// zero or one SourceFile attr per ClassFile: see visitJavaClass()
   
   			checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
  -			
  +
   			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+"'.");
   			}
   
   			checkIndex(obj, obj.getSourceFileIndex(), CONST_Utf8);
  -			
  +
   			String sourcefilename = ((ConstantUtf8) cp.getConstant(obj.getSourceFileIndex())).getBytes(); //==obj.getSourceFileName() ?
   			String sourcefilenamelc = sourcefilename.toLowerCase();
   
  @@ -717,7 +720,7 @@
   		public void visitInnerClasses(InnerClasses obj){//vmspec2 4.7.5
   
   			// exactly one InnerClasses attr per ClassFile if some inner class is refernced: see visitJavaClass()
  -		
  +
   			checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
   
   			String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
  @@ -726,7 +729,7 @@
   			}
   
   			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();
  @@ -770,7 +773,7 @@
   					throw new ClassConstraintException("Invalid index '"+index+"' used by '"+tostring(obj)+"'.");
   				}
   				Constant c = cp.getConstant(index);
  -				
  +
   				if (CONST_Long.isInstance(c) && field_type.equals(Type.LONG)){
   					return;
   				}
  @@ -786,7 +789,7 @@
   				if (CONST_String.isInstance(c) && field_type.equals(Type.STRING)){
   					return;
   				}
  -								
  +
   				throw new ClassConstraintException("Illegal type of ConstantValue '"+obj+"' embedding Constant '"+c+"'. It is referenced by field '"+tostring(f)+"' expecting a different type: '"+field_type+"'.");
   			}
   		}
  @@ -805,7 +808,7 @@
   			if (! name.equals("Code")){
   				throw new ClassConstraintException("The Code attribute '"+tostring(obj)+"' is not correctly named 'Code' but '"+name+"'.");
   			}
  -			
  +
   			Method m = null; // satisfy compiler
   			if (!(carrier.predecessor() instanceof Method)){
   				addMessage("Code attribute '"+tostring(obj)+"' is not declared in a method_info structure but in '"+carrier.predecessor()+"'. Ignored.");
  @@ -829,7 +832,7 @@
   					ConstantClass cc = (ConstantClass) (cp.getConstant(exc_index));
   					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('/','.');
  -				
  +
   					Verifier v = VerifierFactory.getVerifier(cname);
   					VerificationResult vr = v.doPass1();
   
  @@ -858,7 +861,7 @@
   					}
   				}
   			}
  -			
  +
   			// Create object for local variables information
   			// This is highly unelegant due to usage of the Visitor pattern.
   			// TODO: rework it.
  @@ -874,7 +877,7 @@
   				throw new AssertionViolatedException("Could not find a known BCEL Method object in the corresponding BCEL JavaClass object.");
   			}
   			localVariablesInfos[method_number] = new LocalVariablesInfo(obj.getMaxLocals());
  -			
  +
   			int num_of_lvt_attribs = 0;
   			// Now iterate through the attributes the Code attribute has.
   			Attribute[] atts = obj.getAttributes();
  @@ -886,13 +889,13 @@
   				else{// LineNumberTable or LocalVariableTable
   					addMessage("Attribute '"+tostring(atts[a])+"' as an attribute of Code attribute '"+tostring(obj)+"' (method '"+m+"') will effectively be ignored and is only useful for debuggers and such.");
   				}
  -			
  +
   				//LocalVariableTable check (partially delayed to Pass3a).
   				//Here because its easier to collect the information of the
   				//(possibly more than one) LocalVariableTables belonging to
   				//one certain Code attribute.
   				if (atts[a] instanceof LocalVariableTable){ // checks conforming to vmspec2 4.7.9
  -					
  +
   					LocalVariableTable lvt = (LocalVariableTable) atts[a];
   
   					checkIndex(lvt, lvt.getNameIndex(), CONST_Utf8);
  @@ -903,7 +906,6 @@
   					}
   
   					Code code = obj;
  -					int max_locals = code.getMaxLocals();
   
   					//In JustIce, the check for correct offsets into the code array is delayed to Pass 3a.
   					LocalVariable[] localvariables = lvt.getLocalVariableTable();
  @@ -928,7 +930,7 @@
   						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()+"'.");
   						}
  -						
  +
   						try{
   							localVariablesInfos[method_number].add(localindex, localname, localvariables[i].getStartPC(), localvariables[i].getLength(), t);
   						}
  @@ -936,7 +938,7 @@
   							throw new ClassConstraintException("Conflicting information in LocalVariableTable '"+tostring(lvt)+"' found in Code attribute '"+tostring(obj)+"' (method '"+tostring(m)+"'). "+lviie.getMessage());
   						}
   					}// for all local variables localvariables[i] in the LocalVariableTable attribute atts[a] END
  -					
  +
   					num_of_lvt_attribs++;
   					if (num_of_lvt_attribs > obj.getMaxLocals()){
   						throw new ClassConstraintException("Number of LocalVariableTable attributes of Code attribute '"+tostring(obj)+"' (method '"+tostring(m)+"') exceeds number of local variable slots '"+obj.getMaxLocals()+"' ('There may be no more than one LocalVariableTable attribute per local variable in the Code attribute.').");
  @@ -944,7 +946,7 @@
   				}// if atts[a] instanceof LocalVariableTable END
   			}// for all attributes atts[a] END
   		}// visitCode(Code) END
  -		
  +
   		public void visitExceptionTable(ExceptionTable obj){//vmspec2 4.7.4
   			// incorrectly named, it's the Exceptions attribute (vmspec2 4.7.4)
   			checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
  @@ -953,16 +955,16 @@
   			if (! name.equals("Exceptions")){
   				throw new ClassConstraintException("The Exceptions attribute '"+tostring(obj)+"' is not correctly named 'Exceptions' but '"+name+"'.");
   			}
  -			
  +
   			int[] exc_indices = obj.getExceptionIndexTable();
   
   			for (int i=0; i<exc_indices.length; i++){
   				checkIndex(obj, exc_indices[i], CONST_Class);
  -			
  +
   				ConstantClass cc = (ConstantClass) (cp.getConstant(exc_indices[i]));
   				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
  -				
  +
   				Verifier v = VerifierFactory.getVerifier(cname);
   				VerificationResult vr = v.doPass1();
   
  @@ -1019,7 +1021,7 @@
   		public void visitUnknown(Unknown obj){//vmspec2 4.7.1
   			// Represents an unknown attribute.
   			checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
  -			
  +
   			// Maybe only misnamed? Give a (warning) message.
   			addMessage("Unknown attribute '"+tostring(obj)+"'. This attribute is not known in any context!");
   		}
  @@ -1036,7 +1038,7 @@
   			// Code constraints are checked in Pass3 (3a and 3b).
   			// This does not represent an Attribute but is only
   			// related to internal BCEL data representation.
  -		
  +
   			// see visitCode(Code)
   		}
   		public void visitConstantPool(ConstantPool obj){
  @@ -1086,10 +1088,8 @@
   	 * @see org.apache.bcel.classfile.ConstantCP
   	 */
   	private class FAMRAV_Visitor extends EmptyVisitor implements Visitor{
  -		private final JavaClass jc;
   		private final ConstantPool cp; // ==jc.getConstantPool() -- only here to save typing work.
   		private FAMRAV_Visitor(JavaClass _jc){
  -			jc = _jc;
   			cp = _jc.getConstantPool();
   		}
   		
  @@ -1114,7 +1114,7 @@
   			String sig  = ((ConstantUtf8) (cp.getConstant(cnat.getSignatureIndex()))).getBytes(); // Field or Method signature(=descriptor)
   						
   			try{
  -				Type t = Type.getType(sig);
  +				Type.getType(sig); /* Don't need the return value */
   			}
   			catch (ClassFormatError cfe){
   				// Well, BCEL sometimes is a little harsh describing exceptional situations.
  @@ -1144,7 +1144,6 @@
   						
   			try{
   				Type   t  = Type.getReturnType(sig);
  -				Type[] ts = Type.getArgumentTypes(sig);
   				if ( name.equals(CONSTRUCTOR_NAME) && (t != Type.VOID) ){
   					throw new ClassConstraintException("Instance initialization method must have VOID return type.");
   				}
  @@ -1177,7 +1176,6 @@
   						
   			try{
   				Type   t  = Type.getReturnType(sig);
  -				Type[] ts = Type.getArgumentTypes(sig);
   				if ( name.equals(STATIC_INITIALIZER_NAME) && (t != Type.VOID) ){
   					addMessage("Class or interface initialization method '"+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.");
   				}
  @@ -1196,7 +1194,10 @@
   	 * represents a valid Java class name.
   	 */
   	private static final boolean validClassName(String name){
  -		// Are there restrictions?
  +        /*
  +         * TODO: implement.
  +		 * Are there any restrictions?
  +         */
   		return true;
   	}
   	/**
  
  
  
  1.3       +1 -3      jakarta-bcel/src/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
  
  Index: Pass3aVerifier.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Pass3aVerifier.java	26 Apr 2002 22:35:40 -0000	1.2
  +++ Pass3aVerifier.java	13 Jun 2002 09:32:50 -0000	1.3
  @@ -59,8 +59,6 @@
   import org.apache.bcel.classfile.*;
   import org.apache.bcel.verifier.*;
   import org.apache.bcel.verifier.exc.*;
  -import java.util.ArrayList;
  -import java.util.HashMap;
   
   /**
    * This PassVerifier verifies a class file according to
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>