tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r887610 [3/6] - in /tomcat/trunk/java/org/apache/tomcat/util/bcel: ./ classfile/ generic/ util/
Date Sat, 05 Dec 2009 23:22:52 GMT
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Sat Dec  5 23:22:46 2009
@@ -16,28 +16,12 @@
  */
 package org.apache.tomcat.util.bcel.classfile;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.CharArrayReader;
-import java.io.CharArrayWriter;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
 import java.io.FilterReader;
 import java.io.FilterWriter;
 import java.io.IOException;
-import java.io.PrintStream;
-import java.io.PrintWriter;
 import java.io.Reader;
 import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
 import org.apache.tomcat.util.bcel.Constants;
-import org.apache.tomcat.util.bcel.generic.AnnotationEntryGen;
-import org.apache.tomcat.util.bcel.generic.ConstantPoolGen;
 import org.apache.tomcat.util.bcel.util.ByteSequence;
 
 /**
@@ -168,10 +152,7 @@
     }
 
 
-    public static final String codeToString( byte[] code, ConstantPool constant_pool, int index,
-            int length ) {
-        return codeToString(code, constant_pool, index, length, true);
-    }
+    
 
 
     /**
@@ -427,10 +408,7 @@
     }
 
 
-    public static final String codeToString( ByteSequence bytes, ConstantPool constant_pool )
-            throws IOException {
-        return codeToString(bytes, constant_pool, true);
-    }
+    
 
 
     /**
@@ -484,145 +462,34 @@
     }
 
 
-    /**
-     * @return `flag' with bit `i' set to 1
-     */
-    public static final int setBit( int flag, int i ) {
-        return flag | pow2(i);
-    }
+    
 
 
-    /**
-     * @return `flag' with bit `i' set to 0
-     */
-    public static final int clearBit( int flag, int i ) {
-        int bit = pow2(i);
-        return (flag & bit) == 0 ? flag : flag ^ bit;
-    }
+    
 
 
-    /**
-     * @return true, if bit `i' in `flag' is set
-     */
-    public static final boolean isSet( int flag, int i ) {
-        return (flag & pow2(i)) != 0;
-    }
+    
 
 
-    /**
-     * Converts string containing the method return and argument types 
-     * to a byte code method signature.
-     *
-     * @param  ret Return type of method
-     * @param  argv Types of method arguments
-     * @return Byte code representation of method signature
-     */
-    public final static String methodTypeToSignature( String ret, String[] argv )
-            throws ClassFormatException {
-        StringBuffer buf = new StringBuffer("(");
-        String str;
-        if (argv != null) {
-            for (int i = 0; i < argv.length; i++) {
-                str = getSignature(argv[i]);
-                if (str.endsWith("V")) {
-                    throw new ClassFormatException("Invalid type: " + argv[i]);
-                }
-                buf.append(str);
-            }
-        }
-        str = getSignature(ret);
-        buf.append(")").append(str);
-        return buf.toString();
-    }
+    
 
 
-    /**
-     * @param  signature    Method signature
-     * @return Array of argument types
-     * @throws  ClassFormatException  
-     */
-    public static final String[] methodSignatureArgumentTypes( String signature )
-            throws ClassFormatException {
-        return methodSignatureArgumentTypes(signature, true);
-    }
+    
 
 
-    /**
-     * @param  signature    Method signature
-     * @param chopit Shorten class names ?
-     * @return Array of argument types
-     * @throws  ClassFormatException  
-     */
-    public static final String[] methodSignatureArgumentTypes( String signature, boolean chopit )
-            throws ClassFormatException {
-        List vec = new ArrayList();
-        int index;
-        try { // Read all declarations between for `(' and `)'
-            if (signature.charAt(0) != '(') {
-                throw new ClassFormatException("Invalid method signature: " + signature);
-            }
-            index = 1; // current string position
-            while (signature.charAt(index) != ')') {
-                vec.add(signatureToString(signature.substring(index), chopit));
-                //corrected concurrent private static field acess
-                index += unwrap(consumed_chars); // update position
-            }
-        } catch (StringIndexOutOfBoundsException e) { // Should never occur
-            throw new ClassFormatException("Invalid method signature: " + signature, e);
-        }
-        return (String[]) vec.toArray(new String[vec.size()]);
-    }
+    
 
 
-    /**
-     * @param  signature    Method signature
-     * @return return type of method
-     * @throws  ClassFormatException  
-     */
-    public static final String methodSignatureReturnType( String signature )
-            throws ClassFormatException {
-        return methodSignatureReturnType(signature, true);
-    }
+    
 
 
-    /**
-     * @param  signature    Method signature
-     * @param chopit Shorten class names ?
-     * @return return type of method
-     * @throws  ClassFormatException  
-     */
-    public static final String methodSignatureReturnType( String signature, boolean chopit )
-            throws ClassFormatException {
-        int index;
-        String type;
-        try {
-            // Read return type after `)'
-            index = signature.lastIndexOf(')') + 1;
-            type = signatureToString(signature.substring(index), chopit);
-        } catch (StringIndexOutOfBoundsException e) { // Should never occur
-            throw new ClassFormatException("Invalid method signature: " + signature, e);
-        }
-        return type;
-    }
+    
 
 
-    /**
-     * Converts method signature to string with all class names compacted.
-     *
-     * @param signature to convert
-     * @param name of method
-     * @param access flags of method
-     * @return Human readable signature
-     */
-    public static final String methodSignatureToString( String signature, String name, String access ) {
-        return methodSignatureToString(signature, name, access, true);
-    }
+    
 
 
-    public static final String methodSignatureToString( String signature, String name,
-            String access, boolean chopit ) {
-        return methodSignatureToString(signature, name, access, chopit, null);
-    }
+    
 
 
     /**
@@ -839,113 +706,7 @@
     }
 
 
-    /** Parse Java type such as "char", or "java.lang.String[]" and return the
-     * signature in byte code format, e.g. "C" or "[Ljava/lang/String;" respectively.
-     *
-     * @param  type Java type
-     * @return byte code signature
-     */
-    public static String getSignature( String type ) {
-        StringBuffer buf = new StringBuffer();
-        char[] chars = type.toCharArray();
-        boolean char_found = false, delim = false;
-        int index = -1;
-        loop: for (int i = 0; i < chars.length; i++) {
-            switch (chars[i]) {
-                case ' ':
-                case '\t':
-                case '\n':
-                case '\r':
-                case '\f':
-                    if (char_found) {
-                        delim = true;
-                    }
-                    break;
-                case '[':
-                    if (!char_found) {
-                        throw new RuntimeException("Illegal type: " + type);
-                    }
-                    index = i;
-                    break loop;
-                default:
-                    char_found = true;
-                    if (!delim) {
-                        buf.append(chars[i]);
-                    }
-            }
-        }
-        int brackets = 0;
-        if (index > 0) {
-            brackets = countBrackets(type.substring(index));
-        }
-        type = buf.toString();
-        buf.setLength(0);
-        for (int i = 0; i < brackets; i++) {
-            buf.append('[');
-        }
-        boolean found = false;
-        for (int i = Constants.T_BOOLEAN; (i <= Constants.T_VOID) && !found; i++) {
-            if (Constants.TYPE_NAMES[i].equals(type)) {
-                found = true;
-                buf.append(Constants.SHORT_TYPE_NAMES[i]);
-            }
-        }
-        if (!found) {
-            buf.append('L').append(type.replace('.', '/')).append(';');
-        }
-        return buf.toString();
-    }
-
-
-    private static int countBrackets( String brackets ) {
-        char[] chars = brackets.toCharArray();
-        int count = 0;
-        boolean open = false;
-        for (int i = 0; i < chars.length; i++) {
-            switch (chars[i]) {
-                case '[':
-                    if (open) {
-                        throw new RuntimeException("Illegally nested brackets:" + brackets);
-                    }
-                    open = true;
-                    break;
-                case ']':
-                    if (!open) {
-                        throw new RuntimeException("Illegally nested brackets:" + brackets);
-                    }
-                    open = false;
-                    count++;
-                    break;
-                default:
-                    // Don't care
-            }
-        }
-        if (open) {
-            throw new RuntimeException("Illegally nested brackets:" + brackets);
-        }
-        return count;
-    }
-
-
-    /**
-     * Return type of method signature as a byte value as defined in <em>Constants</em>
-     *
-     * @param  signature in format described above
-     * @return type of method signature
-     * @see    Constants
-     */
-    public static final byte typeOfMethodSignature( String signature ) throws ClassFormatException {
-        int index;
-        try {
-            if (signature.charAt(0) != '(') {
-                throw new ClassFormatException("Invalid method signature: " + signature);
-            }
-            index = signature.lastIndexOf(')') + 1;
-            return typeOfSignature(signature.substring(index));
-        } catch (StringIndexOutOfBoundsException e) {
-            throw new ClassFormatException("Invalid method signature: " + signature, e);
-        }
-    }
+    
 
 
     /**
@@ -989,17 +750,7 @@
     }
 
 
-    /** Map opcode names to opcode numbers. E.g., return Constants.ALOAD for "aload"
-     */
-    public static short searchOpcode( String name ) {
-        name = name.toLowerCase(Locale.ENGLISH);
-        for (short i = 0; i < Constants.OPCODE_NAMES.length; i++) {
-            if (Constants.OPCODE_NAMES[i].equals(name)) {
-                return i;
-            }
-        }
-        return -1;
-    }
+    
 
 
     /**
@@ -1069,64 +820,22 @@
     }
 
 
-    static final boolean equals( byte[] a, byte[] b ) {
-        int size;
-        if ((size = a.length) != b.length) {
-            return false;
-        }
-        for (int i = 0; i < size; i++) {
-            if (a[i] != b[i]) {
-                return false;
-            }
-        }
-        return true;
-    }
+    
 
 
-    public static final void printArray( PrintStream out, Object[] obj ) {
-        out.println(printArray(obj, true));
-    }
+    
 
 
-    public static final void printArray( PrintWriter out, Object[] obj ) {
-        out.println(printArray(obj, true));
-    }
+    
 
 
-    public static final String printArray( Object[] obj ) {
-        return printArray(obj, true);
-    }
+    
 
 
-    public static final String printArray( Object[] obj, boolean braces ) {
-        return printArray(obj, braces, false);
-    }
+    
 
 
-    public static final String printArray( Object[] obj, boolean braces, boolean quote ) {
-        if (obj == null) {
-            return null;
-        }
-        StringBuffer buf = new StringBuffer();
-        if (braces) {
-            buf.append('{');
-        }
-        for (int i = 0; i < obj.length; i++) {
-            if (obj[i] != null) {
-                buf.append((quote ? "\"" : "")).append(obj[i].toString()).append(
-                        (quote ? "\"" : ""));
-            } else {
-                buf.append("null");
-            }
-            if (i < obj.length - 1) {
-                buf.append(", ");
-            }
-        }
-        if (braces) {
-            buf.append('}');
-        }
-        return buf.toString();
-    }
+    
 
 
     /** @return true, if character is one of (a, ... z, A, ... Z, 0, ... 9, _)
@@ -1137,72 +846,10 @@
     }
 
 
-    /** Encode byte array it into Java identifier string, i.e., a string
-     * that only contains the following characters: (a, ... z, A, ... Z,
-     * 0, ... 9, _, $).  The encoding algorithm itself is not too
-     * clever: if the current byte's ASCII value already is a valid Java
-     * identifier part, leave it as it is. Otherwise it writes the
-     * escape character($) followed by <p><ul><li> the ASCII value as a
-     * hexadecimal string, if the value is not in the range
-     * 200..247</li> <li>a Java identifier char not used in a lowercase
-     * hexadecimal string, if the value is in the range
-     * 200..247</li><ul></p>
-     *
-     * <p>This operation inflates the original byte array by roughly 40-50%</p>
-     *
-     * @param bytes the byte array to convert
-     * @param compress use gzip to minimize string
-     */
-    public static String encode( byte[] bytes, boolean compress ) throws IOException {
-        if (compress) {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            GZIPOutputStream gos = new GZIPOutputStream(baos);
-            gos.write(bytes, 0, bytes.length);
-            gos.close();
-            baos.close();
-            bytes = baos.toByteArray();
-        }
-        CharArrayWriter caw = new CharArrayWriter();
-        JavaWriter jw = new JavaWriter(caw);
-        for (int i = 0; i < bytes.length; i++) {
-            int in = bytes[i] & 0x000000ff; // Normalize to unsigned
-            jw.write(in);
-        }
-        return caw.toString();
-    }
+    
 
 
-    /** Decode a string back to a byte array.
-     *
-     * @param s the string to convert
-     * @param uncompress use gzip to uncompress the stream of bytes
-     */
-    public static byte[] decode( String s, boolean uncompress ) throws IOException {
-        char[] chars = s.toCharArray();
-        CharArrayReader car = new CharArrayReader(chars);
-        JavaReader jr = new JavaReader(car);
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        int ch;
-        while ((ch = jr.read()) >= 0) {
-            bos.write(ch);
-        }
-        bos.close();
-        car.close();
-        jr.close();
-        byte[] bytes = bos.toByteArray();
-        if (uncompress) {
-            GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes));
-            byte[] tmp = new byte[bytes.length * 3]; // Rough estimate
-            int count = 0;
-            int b;
-            while ((b = gis.read()) >= 0) {
-                tmp[count++] = (byte) b;
-            }
-            bytes = new byte[count];
-            System.arraycopy(tmp, 0, bytes, 0, count);
-        }
-        return bytes;
-    }
+    
 
     // A-Z, g-z, _, $
     private static final int FREE_CHARS = 48;
@@ -1347,179 +994,9 @@
     }
 
 
-    /**
-     * Converts a list of AnnotationGen objects into a set of attributes 
-     * that can be attached to the class file.
-     *
-     * @param cp The constant pool gen where we can create the necessary name refs
-     * @param vec A list of AnnotationGen objects
-     */
-    public static Attribute[] getAnnotationAttributes(ConstantPoolGen cp,List vec) {
-    	
-    	if (vec.isEmpty()) return new Attribute[0];
-    	
-    	try {
-    		int countVisible   = 0;
-    		int countInvisible = 0;
-    	
-    		//  put the annotations in the right output stream
-    		for (int i=0; i<vec.size(); i++) {
-    			AnnotationEntryGen a = (AnnotationEntryGen)vec.get(i);
-    			if (a.isRuntimeVisible()) countVisible++;
-    			else			   countInvisible++;
-    		}
-    	
-    		ByteArrayOutputStream rvaBytes = new ByteArrayOutputStream();
-    		ByteArrayOutputStream riaBytes = new ByteArrayOutputStream();
-    		DataOutputStream rvaDos = new DataOutputStream(rvaBytes);
-    		DataOutputStream riaDos = new DataOutputStream(riaBytes);
-    	
-    		rvaDos.writeShort(countVisible);
-    		riaDos.writeShort(countInvisible);
-
-    		// put the annotations in the right output stream
-    		for (int i=0; i<vec.size(); i++) {
-    			AnnotationEntryGen a = (AnnotationEntryGen)vec.get(i);
-    			if (a.isRuntimeVisible()) a.dump(rvaDos);
-    			else			   a.dump(riaDos);
-    		}
-
-      rvaDos.close();
-      riaDos.close();
-      
-      byte[] rvaData = rvaBytes.toByteArray();
-      byte[] riaData = riaBytes.toByteArray();
-      
-      int rvaIndex = -1;
-      int riaIndex = -1;
-      
-      if (rvaData.length>2) rvaIndex = cp.addUtf8("RuntimeVisibleAnnotations");
-      if (riaData.length>2) riaIndex = cp.addUtf8("RuntimeInvisibleAnnotations");
-
-    	List newAttributes = new ArrayList();
-    	if (rvaData.length>2) {
-    		
-    		newAttributes.add(
-    		  new RuntimeVisibleAnnotations(rvaIndex,rvaData.length,new DataInputStream(new ByteArrayInputStream(rvaData)),cp.getConstantPool()));
-    	}
-    	if (riaData.length>2) {
-    		newAttributes.add(
-    		  new RuntimeInvisibleAnnotations(riaIndex,riaData.length,new DataInputStream(new ByteArrayInputStream(riaData)),cp.getConstantPool()));
-    	}
-
-    	return (Attribute[])newAttributes.toArray(new Attribute[newAttributes.size()]);
-    	} catch (IOException e) {
-    		System.err.println("IOException whilst processing annotations");
-  		e.printStackTrace();
-  	}
-    	return null;
-    }
+    
 
 
-    /**
-	 * Annotations against a class are stored in one of four attribute kinds:
-	 * - RuntimeVisibleParameterAnnotations
-	 * - RuntimeInvisibleParameterAnnotations
-	 */
-	public static Attribute[] getParameterAnnotationAttributes(
-			ConstantPoolGen cp,
-			List[] /*Array of lists, array size depends on #params */vec)
-	{
-		int visCount[] = new int[vec.length];
-		int totalVisCount = 0;
-		int invisCount[] = new int[vec.length];
-		int totalInvisCount = 0;
-		try
-		{
-			for (int i = 0; i < vec.length; i++)
-			{
-				List l = vec[i];
-				if (l != null)
-				{
-					for (Iterator iter = l.iterator(); iter.hasNext();)
-					{
-						AnnotationEntryGen element = (AnnotationEntryGen) iter.next();
-						if (element.isRuntimeVisible())
-						{
-							visCount[i]++;
-							totalVisCount++;
-						}
-						else
-						{
-							invisCount[i]++;
-							totalInvisCount++;
-						}
-					}
-				}
-			}
-			// Lets do the visible ones
-			ByteArrayOutputStream rvaBytes = new ByteArrayOutputStream();
-			DataOutputStream rvaDos = new DataOutputStream(rvaBytes);
-			rvaDos.writeByte(vec.length); // First goes number of parameters
-			for (int i = 0; i < vec.length; i++)
-			{
-				rvaDos.writeShort(visCount[i]);
-				if (visCount[i] > 0)
-				{
-					List l = vec[i];
-					for (Iterator iter = l.iterator(); iter.hasNext();)
-					{
-						AnnotationEntryGen element = (AnnotationEntryGen) iter.next();
-						if (element.isRuntimeVisible())
-							element.dump(rvaDos);
-					}
-				}
-			}
-			rvaDos.close();
-			// Lets do the invisible ones
-			ByteArrayOutputStream riaBytes = new ByteArrayOutputStream();
-			DataOutputStream riaDos = new DataOutputStream(riaBytes);
-			riaDos.writeByte(vec.length); // First goes number of parameters
-			for (int i = 0; i < vec.length; i++)
-			{
-				riaDos.writeShort(invisCount[i]);
-				if (invisCount[i] > 0)
-				{
-					List l = vec[i];
-					for (Iterator iter = l.iterator(); iter.hasNext();)
-					{
-						AnnotationEntryGen element = (AnnotationEntryGen) iter.next();
-						if (!element.isRuntimeVisible())
-							element.dump(riaDos);
-					}
-				}
-			}
-			riaDos.close();
-			byte[] rvaData = rvaBytes.toByteArray();
-			byte[] riaData = riaBytes.toByteArray();
-			int rvaIndex = -1;
-			int riaIndex = -1;
-			if (totalVisCount > 0)
-				rvaIndex = cp.addUtf8("RuntimeVisibleParameterAnnotations");
-			if (totalInvisCount > 0)
-				riaIndex = cp.addUtf8("RuntimeInvisibleParameterAnnotations");
-			List newAttributes = new ArrayList();
-			if (totalVisCount > 0)
-			{
-				newAttributes
-						.add(new RuntimeVisibleParameterAnnotations(rvaIndex,
-								rvaData.length, new DataInputStream(new ByteArrayInputStream(rvaData)), cp.getConstantPool()));
-			}
-			if (totalInvisCount > 0)
-			{
-				newAttributes
-						.add(new RuntimeInvisibleParameterAnnotations(riaIndex,
-								riaData.length, new DataInputStream(new ByteArrayInputStream(riaData)), cp.getConstantPool()));
-			}
-			return (Attribute[]) newAttributes.toArray(new Attribute[newAttributes.size()]);
-		}
-		catch (IOException e)
-		{
-			System.err
-					.println("IOException whilst processing parameter annotations");
-			e.printStackTrace();
-		}
-		return null;
-	}
+    
 
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Visitor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Visitor.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Visitor.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Visitor.java Sat Dec  5 23:22:46 2009
@@ -28,7 +28,7 @@
 {
 	public void visitCode(Code obj);
 
-	public void visitCodeException(CodeException obj);
+	
 
 	public void visitConstantClass(ConstantClass obj);
 
@@ -48,7 +48,7 @@
 
 	public void visitConstantNameAndType(ConstantNameAndType obj);
 
-	public void visitConstantPool(ConstantPool obj);
+	
 
 	public void visitConstantString(ConstantString obj);
 
@@ -60,23 +60,23 @@
 
 	public void visitExceptionTable(ExceptionTable obj);
 
-	public void visitField(Field obj);
+	
 
-	public void visitInnerClass(InnerClass obj);
+	
 
 	public void visitInnerClasses(InnerClasses obj);
 
-	public void visitJavaClass(JavaClass obj);
+	
 
-	public void visitLineNumber(LineNumber obj);
+	
 
 	public void visitLineNumberTable(LineNumberTable obj);
 
-	public void visitLocalVariable(LocalVariable obj);
+	
 
 	public void visitLocalVariableTable(LocalVariableTable obj);
 
-	public void visitMethod(Method obj);
+	
 
 	public void visitSignature(Signature obj);
 
@@ -88,19 +88,19 @@
 
 	public void visitStackMap(StackMap obj);
 
-	public void visitStackMapEntry(StackMapEntry obj);
+	
 
 	public void visitStackMapTable(StackMapTable obj);
 
-	public void visitStackMapTableEntry(StackMapTableEntry obj);
+	
 
 	public void visitAnnotation(Annotations obj);
 
-	public void visitParameterAnnotation(ParameterAnnotations obj);
+	
 
-	public void visitAnnotationEntry(AnnotationEntry obj);
+	
 
-	public void visitAnnotationDefault(AnnotationDefault obj);
+	
 
 	public void visitLocalVariableTypeTable(LocalVariableTypeTable obj);
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ANEWARRAY.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ANEWARRAY.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ANEWARRAY.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ANEWARRAY.java Sat Dec  5 23:22:46 2009
@@ -16,8 +16,6 @@
  */
 package org.apache.tomcat.util.bcel.generic;
 
-import org.apache.tomcat.util.bcel.ExceptionConstants;
-
 /** 
  * ANEWARRAY -  Create new array of references
  * <PRE>Stack: ..., count -&gt; ..., arrayref</PRE>
@@ -36,25 +34,11 @@
     }
 
 
-    public ANEWARRAY(int index) {
-        super(org.apache.tomcat.util.bcel.Constants.ANEWARRAY, index);
-    }
+    
 
 
-    public Class[] getExceptions() {
-        Class[] cs = new Class[1 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION;
-        return cs;
-    }
+    
 
 
-    public ObjectType getLoadClassType( ConstantPoolGen cpg ) {
-        Type t = getType(cpg);
-        if (t instanceof ArrayType) {
-            t = ((ArrayType) t).getBasicType();
-        }
-        return (t instanceof ObjectType) ? (ObjectType) t : null;
-    }
+    
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/AnnotationElementValueGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/AnnotationElementValueGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/AnnotationElementValueGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/AnnotationElementValueGen.java Sat Dec  5 23:22:46 2009
@@ -10,21 +10,9 @@
 	// For annotation element values, this is the annotation
 	private AnnotationEntryGen a;
 
-	public AnnotationElementValueGen(AnnotationEntryGen a, ConstantPoolGen cpool)
-	{
-		super(ANNOTATION, cpool);
-		this.a = a;
-	}
+	
 
-	public AnnotationElementValueGen(int type, AnnotationEntryGen annotation,
-			ConstantPoolGen cpool)
-	{
-		super(type, cpool);
-		if (type != ANNOTATION)
-			throw new RuntimeException(
-					"Only element values of type annotation can be built with this ctor - type specified: " + type);
-		this.a = annotation;
-	}
+	
 
 	public AnnotationElementValueGen(AnnotationElementValue value,
 			ConstantPoolGen cpool, boolean copyPoolEntries)
@@ -53,8 +41,5 @@
 				.getConstantPool());
 	}
 
-	public AnnotationEntryGen getAnnotation()
-	{
-		return a;
-	}
+	
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/AnnotationEntryGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/AnnotationEntryGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/AnnotationEntryGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/AnnotationEntryGen.java Sat Dec  5 23:22:46 2009
@@ -1,6 +1,5 @@
 package org.apache.tomcat.util.bcel.generic;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -58,11 +57,6 @@
 		return out;
 	}
 
-	private AnnotationEntryGen(ConstantPoolGen cpool)
-	{
-		this.cpool = cpool;
-	}
-
 	/**
 	 * Retrieve an immutable version of this AnnotationGen
 	 */
@@ -79,31 +73,9 @@
 		return a;
 	}
 
-	public AnnotationEntryGen(ObjectType type,
-			List /* ElementNameValuePairGen */elements, boolean vis,
-			ConstantPoolGen cpool)
-	{
-		this.cpool = cpool;
-		this.typeIndex = cpool.addUtf8(type.getSignature());
-		evs = elements;
-		isRuntimeVisible = vis;
-	}
+	
 
-	public static AnnotationEntryGen read(DataInputStream dis,
-			ConstantPoolGen cpool, boolean b) throws IOException
-	{
-		AnnotationEntryGen a = new AnnotationEntryGen(cpool);
-		a.typeIndex = dis.readUnsignedShort();
-		int elemValuePairCount = dis.readUnsignedShort();
-		for (int i = 0; i < elemValuePairCount; i++)
-		{
-			int nidx = dis.readUnsignedShort();
-			a.addElementNameValuePair(new ElementValuePairGen(nidx,
-					ElementValueGen.readElementValue(dis, cpool), cpool));
-		}
-		a.isRuntimeVisible(b);
-		return a;
-	}
+	
 
 	public void dump(DataOutputStream dos) throws IOException
 	{
@@ -116,17 +88,9 @@
 		}
 	}
 
-	public void addElementNameValuePair(ElementValuePairGen evp)
-	{
-		if (evs == null)
-			evs = new ArrayList();
-		evs.add(evp);
-	}
+	
 
-	public int getTypeIndex()
-	{
-		return typeIndex;
-	}
+	
 
 	public final String getTypeSignature()
 	{
@@ -142,13 +106,7 @@
 									// Utility.signatureToString(getTypeSignature());
 	}
 
-	/**
-	 * Returns list of ElementNameValuePair objects
-	 */
-	public List getValues()
-	{
-		return evs;
-	}
+	
 
 	public String toString()
 	{
@@ -164,27 +122,7 @@
 		return s.toString();
 	}
 
-	public String toShortString()
-	{
-		StringBuffer s = new StringBuffer();
-		s.append("@" + getTypeName() + "(");
-		for (int i = 0; i < evs.size(); i++)
-		{
-			s.append(evs.get(i));
-			if (i + 1 < evs.size())
-				s.append(",");
-		}
-		s.append(")");
-		return s.toString();
-	}
-
-	private void isRuntimeVisible(boolean b)
-	{
-		isRuntimeVisible = b;
-	}
+	
 
-	public boolean isRuntimeVisible()
-	{
-		return isRuntimeVisible;
-	}
+	
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ArrayElementValueGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ArrayElementValueGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ArrayElementValueGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ArrayElementValueGen.java Sat Dec  5 23:22:46 2009
@@ -14,25 +14,9 @@
 	// modify ...
 	private List /* ElementValueGen */evalues;
 
-	public ArrayElementValueGen(ConstantPoolGen cp)
-	{
-		super(ARRAY, cp);
-		evalues = new ArrayList();
-	}
+	
 
-	public ArrayElementValueGen(int type, ElementValue[] datums,
-			ConstantPoolGen cpool)
-	{
-		super(type, cpool);
-		if (type != ARRAY)
-			throw new RuntimeException(
-					"Only element values of type array can be built with this ctor - type specified: " + type);
-		this.evalues = new ArrayList();
-		for (int i = 0; i < datums.length; i++)
-		{
-			evalues.add(datums[i]);
-		}
-	}
+	
 
 	/**
 	 * Return immutable variant of this ArrayElementValueGen
@@ -92,18 +76,9 @@
 		return sb.toString();
 	}
 
-	public List getElementValues()
-	{
-		return evalues;
-	}
+	
 
-	public int getElementValuesSize()
-	{
-		return evalues.size();
-	}
+	
 
-	public void addElement(ElementValueGen gen)
-	{
-		evalues.add(gen);
-	}
+	
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ArrayType.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ArrayType.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ArrayType.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ArrayType.java Sat Dec  5 23:22:46 2009
@@ -30,24 +30,10 @@
     private Type basic_type;
 
 
-    /**
-     * Convenience constructor for array type, e.g. int[]
-     *
-     * @param type array type, e.g. T_INT
-     */
-    public ArrayType(byte type, int dimensions) {
-        this(BasicType.getType(type), dimensions);
-    }
+    
 
 
-    /**
-     * Convenience constructor for reference array type, e.g. Object[]
-     *
-     * @param class_name complete name of class (java.lang.String, e.g.)
-     */
-    public ArrayType(String class_name, int dimensions) {
-        this(new ObjectType(class_name), dimensions);
-    }
+    
 
 
     /**
@@ -82,30 +68,13 @@
     }
 
 
-    /**
-     * @return basic type of array, i.e., for int[][][] the basic type is int
-     */
-    public Type getBasicType() {
-        return basic_type;
-    }
+    
 
 
-    /**
-     * @return element type of array, i.e., for int[][][] the element type is int[][]
-     */
-    public Type getElementType() {
-        if (dimensions == 1) {
-            return basic_type;
-        }
-        return new ArrayType(basic_type, dimensions - 1);
-    }
+    
 
 
-    /** @return number of dimensions of array
-     */
-    public int getDimensions() {
-        return dimensions;
-    }
+    
 
 
     /** @return a hash code value for the object.

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/BIPUSH.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/BIPUSH.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/BIPUSH.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/BIPUSH.java Sat Dec  5 23:22:46 2009
@@ -41,12 +41,7 @@
     }
 
 
-    /** Push byte on stack
-     */
-    public BIPUSH(byte b) {
-        super(org.apache.tomcat.util.bcel.Constants.BIPUSH, (short) 2);
-        this.b = b;
-    }
+    
 
 
     /**

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/BranchHandle.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/BranchHandle.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/BranchHandle.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/BranchHandle.java Sat Dec  5 23:22:46 2009
@@ -83,28 +83,13 @@
     }
 
 
-    /**
-     * Pass new target to instruction.
-     */
-    public void setTarget( InstructionHandle ih ) {
-        bi.setTarget(ih);
-    }
+    
 
 
-    /**
-     * Update target of instruction.
-     */
-    public void updateTarget( InstructionHandle old_ih, InstructionHandle new_ih ) {
-        bi.updateTarget(old_ih, new_ih);
-    }
+    
 
 
-    /**
-     * @return target of instruction.
-     */
-    public InstructionHandle getTarget() {
-        return bi.getTarget();
-    }
+    
 
 
     /** 

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/CHECKCAST.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/CHECKCAST.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/CHECKCAST.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/CHECKCAST.java Sat Dec  5 23:22:46 2009
@@ -16,8 +16,6 @@
  */
 package org.apache.tomcat.util.bcel.generic;
 
-import org.apache.tomcat.util.bcel.ExceptionConstants;
-
 /** 
  * CHECKCAST - Check whether object is of given type
  * <PRE>Stack: ..., objectref -&gt; ..., objectref</PRE>
@@ -36,30 +34,11 @@
     }
 
 
-    /** Check whether object is of given type
-     * @param index index to class in constant pool
-     */
-    public CHECKCAST(int index) {
-        super(org.apache.tomcat.util.bcel.Constants.CHECKCAST, index);
-    }
+    
 
 
-    /** @return exceptions this instruction may cause
-     */
-    public Class[] getExceptions() {
-        Class[] cs = new Class[1 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.CLASS_CAST_EXCEPTION;
-        return cs;
-    }
+    
 
 
-    public ObjectType getLoadClassType( ConstantPoolGen cpg ) {
-        Type t = getType(cpg);
-        if (t instanceof ArrayType) {
-            t = ((ArrayType) t).getBasicType();
-        }
-        return (t instanceof ObjectType) ? (ObjectType) t : null;
-    }
+    
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassElementValueGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassElementValueGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassElementValueGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassElementValueGen.java Sat Dec  5 23:22:46 2009
@@ -6,7 +6,6 @@
 import org.apache.tomcat.util.bcel.classfile.ConstantUtf8;
 import org.apache.tomcat.util.bcel.classfile.ClassElementValue;
 import org.apache.tomcat.util.bcel.generic.ConstantPoolGen;
-import org.apache.tomcat.util.bcel.generic.ObjectType;
 import org.apache.tomcat.util.bcel.generic.ElementValueGen;
 
 public class ClassElementValueGen extends ElementValueGen
@@ -16,18 +15,9 @@
 	// For 'class' this points to the class entry in the cpool
 	private int idx;
 
-	protected ClassElementValueGen(int typeIdx, ConstantPoolGen cpool)
-	{
-		super(ElementValueGen.CLASS, cpool);
-		this.idx = typeIdx;
-	}
+	
 
-	public ClassElementValueGen(ObjectType t, ConstantPoolGen cpool)
-	{
-		super(ElementValueGen.CLASS, cpool);
-		// this.idx = cpool.addClass(t);
-		idx = cpool.addUtf8(t.getSignature());
-	}
+	
 
 	/**
 	 * Return immutable variant of this ClassElementValueGen
@@ -52,10 +42,7 @@
 		}
 	}
 
-	public int getIndex()
-	{
-		return idx;
-	}
+	
 
 	public String getClassString()
 	{

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassGen.java Sat Dec  5 23:22:46 2009
@@ -17,22 +17,11 @@
 package org.apache.tomcat.util.bcel.generic;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.tomcat.util.bcel.Constants;
 import org.apache.tomcat.util.bcel.classfile.AccessFlags;
-import org.apache.tomcat.util.bcel.classfile.AnnotationEntry;
-import org.apache.tomcat.util.bcel.classfile.Annotations;
-import org.apache.tomcat.util.bcel.classfile.Attribute;
-import org.apache.tomcat.util.bcel.classfile.ConstantPool;
-import org.apache.tomcat.util.bcel.classfile.Field;
 import org.apache.tomcat.util.bcel.classfile.JavaClass;
-import org.apache.tomcat.util.bcel.classfile.Method;
-import org.apache.tomcat.util.bcel.classfile.RuntimeInvisibleAnnotations;
-import org.apache.tomcat.util.bcel.classfile.RuntimeVisibleAnnotations;
-import org.apache.tomcat.util.bcel.classfile.SourceFile;
-import org.apache.tomcat.util.bcel.classfile.Utility;
 import org.apache.tomcat.util.bcel.util.BCELComparator;
 
 /** 
@@ -74,491 +63,84 @@
     };
 
 
-    /** Convenience constructor to set up some important values initially.
-     *
-     * @param class_name fully qualified class name
-     * @param super_class_name fully qualified superclass name
-     * @param file_name source file name
-     * @param access_flags access qualifiers
-     * @param interfaces implemented interfaces
-     * @param cp constant pool to use
-     */
-    public ClassGen(String class_name, String super_class_name, String file_name, int access_flags,
-            String[] interfaces, ConstantPoolGen cp) {
-        this.class_name = class_name;
-        this.super_class_name = super_class_name;
-        this.file_name = file_name;
-        this.access_flags = access_flags;
-        this.cp = cp;
-        // Put everything needed by default into the constant pool and the vectors
-        if (file_name != null) {
-            addAttribute(new SourceFile(cp.addUtf8("SourceFile"), 2, cp.addUtf8(file_name), cp
-                    .getConstantPool()));
-        }
-        class_name_index = cp.addClass(class_name);
-        superclass_name_index = cp.addClass(super_class_name);
-        if (interfaces != null) {
-            for (int i = 0; i < interfaces.length; i++) {
-                addInterface(interfaces[i]);
-            }
-        }
-    }
-
-
-    /** Convenience constructor to set up some important values initially.
-     *
-     * @param class_name fully qualified class name
-     * @param super_class_name fully qualified superclass name
-     * @param file_name source file name
-     * @param access_flags access qualifiers
-     * @param interfaces implemented interfaces
-     */
-    public ClassGen(String class_name, String super_class_name, String file_name, int access_flags,
-            String[] interfaces) {
-        this(class_name, super_class_name, file_name, access_flags, interfaces,
-                new ConstantPoolGen());
-    }
-
-
-    /**
-     * Initialize with existing class.
-     * @param clazz JavaClass object (e.g. read from file)
-     */
-    public ClassGen(JavaClass clazz) {
-        class_name_index = clazz.getClassNameIndex();
-        superclass_name_index = clazz.getSuperclassNameIndex();
-        class_name = clazz.getClassName();
-        super_class_name = clazz.getSuperclassName();
-        file_name = clazz.getSourceFileName();
-        access_flags = clazz.getAccessFlags();
-        cp = new ConstantPoolGen(clazz.getConstantPool());
-        major = clazz.getMajor();
-        minor = clazz.getMinor();
-        Attribute[] attributes = clazz.getAttributes();
-        // J5TODO: Could make unpacking lazy, done on first reference
-        AnnotationEntryGen[] annotations = unpackAnnotations(attributes);
-        Method[] methods = clazz.getMethods();
-        Field[] fields = clazz.getFields();
-        String[] interfaces = clazz.getInterfaceNames();
-        for (int i = 0; i < interfaces.length; i++) {
-            addInterface(interfaces[i]);
-        }
-        for (int i = 0; i < attributes.length; i++) {
-        	if (!(attributes[i] instanceof Annotations)) {
-        		addAttribute(attributes[i]);
-        	}
-        }
-        for(int i=0; i < annotations.length; i++) {
-            addAnnotationEntry(annotations[i]);
-        }
-        for (int i = 0; i < methods.length; i++) {
-            addMethod(methods[i]);
-        }
-        for (int i = 0; i < fields.length; i++) {
-            addField(fields[i]);
-        }
-    }
     
-    /**
-	 * Look for attributes representing annotations and unpack them.
-	 */
-	private AnnotationEntryGen[] unpackAnnotations(Attribute[] attrs)
-	{
-		List /* AnnotationGen */annotationGenObjs = new ArrayList();
-		for (int i = 0; i < attrs.length; i++)
-		{
-			Attribute attr = attrs[i];
-			if (attr instanceof RuntimeVisibleAnnotations)
-			{
-				RuntimeVisibleAnnotations rva = (RuntimeVisibleAnnotations) attr;
-				AnnotationEntry[] annos = rva.getAnnotationEntries();
-				for (int j = 0; j < annos.length; j++)
-				{
-					AnnotationEntry a = annos[j];
-					annotationGenObjs.add(new AnnotationEntryGen(a,
-							getConstantPool(), false));
-				}
-			}
-			else
-				if (attr instanceof RuntimeInvisibleAnnotations)
-				{
-					RuntimeInvisibleAnnotations ria = (RuntimeInvisibleAnnotations) attr;
-					AnnotationEntry[] annos = ria.getAnnotationEntries();
-					for (int j = 0; j < annos.length; j++)
-					{
-						AnnotationEntry a = annos[j];
-						annotationGenObjs.add(new AnnotationEntryGen(a,
-								getConstantPool(), false));
-					}
-				}
-		}
-		return (AnnotationEntryGen[]) annotationGenObjs
-				.toArray(new AnnotationEntryGen[annotationGenObjs.size()]);
-	}
-
-
-    /**
-     * @return the (finally) built up Java class object.
-     */
-    public JavaClass getJavaClass() {
-        int[] interfaces = getInterfaces();
-        Field[] fields = getFields();
-        Method[] methods = getMethods();
-        Attribute[] attributes = null;
-        if (annotation_vec.isEmpty()) {
-        	attributes = getAttributes();
-        } else {
-        	// TODO: Sometime later, trash any attributes called 'RuntimeVisibleAnnotations' or 'RuntimeInvisibleAnnotations'
-            Attribute[] annAttributes  = Utility.getAnnotationAttributes(cp,annotation_vec);
-            attributes = new Attribute[attribute_vec.size()+annAttributes.length];
-            attribute_vec.toArray(attributes);
-            System.arraycopy(annAttributes,0,attributes,attribute_vec.size(),annAttributes.length);       
-        }
-        // Must be last since the above calls may still add something to it
-        ConstantPool _cp = this.cp.getFinalConstantPool();
-        return new JavaClass(class_name_index, superclass_name_index, file_name, major, minor,
-                access_flags, _cp, interfaces, fields, methods, attributes);
-    }
-
-
-    /**
-     * Add an interface to this class, i.e., this class has to implement it.
-     * @param name interface to implement (fully qualified class name)
-     */
-    public void addInterface( String name ) {
-        interface_vec.add(name);
-    }
-
-
-    /**
-     * Remove an interface from this class.
-     * @param name interface to remove (fully qualified name)
-     */
-    public void removeInterface( String name ) {
-        interface_vec.remove(name);
-    }
-
-
-    /**
-     * @return major version number of class file
-     */
-    public int getMajor() {
-        return major;
-    }
-
-
-    /** Set major version number of class file, default value is 45 (JDK 1.1)
-     * @param major major version number
-     */
-    public void setMajor( int major ) {
-        this.major = major;
-    }
 
 
-    /** Set minor version number of class file, default value is 3 (JDK 1.1)
-     * @param minor minor version number
-     */
-    public void setMinor( int minor ) {
-        this.minor = minor;
-    }
-
-
-    /**
-     * @return minor version number of class file
-     */
-    public int getMinor() {
-        return minor;
-    }
-
-
-    /**
-     * Add an attribute to this class.
-     * @param a attribute to add
-     */
-    public void addAttribute( Attribute a ) {
-        attribute_vec.add(a);
-    }
     
-    public void addAnnotationEntry(AnnotationEntryGen a) { 
-    	annotation_vec.add(a); 
-    }
-
-
-    /**
-     * Add a method to this class.
-     * @param m method to add
-     */
-    public void addMethod( Method m ) {
-        method_vec.add(m);
-    }
-
-
-    /**
-     * Convenience method.
-     *
-     * Add an empty constructor to this class that does nothing but calling super().
-     * @param access_flags rights for constructor
-     */
-    public void addEmptyConstructor( int access_flags ) {
-        InstructionList il = new InstructionList();
-        il.append(InstructionConstants.THIS); // Push `this'
-        il.append(new INVOKESPECIAL(cp.addMethodref(super_class_name, "<init>", "()V")));
-        il.append(InstructionConstants.RETURN);
-        MethodGen mg = new MethodGen(access_flags, Type.VOID, Type.NO_ARGS, null, "<init>",
-                class_name, il, cp);
-        mg.setMaxStack(1);
-        addMethod(mg.getMethod());
-    }
-
-
-    /**
-     * Add a field to this class.
-     * @param f field to add
-     */
-    public void addField( Field f ) {
-        field_vec.add(f);
-    }
-
-
-    public boolean containsField( Field f ) {
-        return field_vec.contains(f);
-    }
-
-
-    /** @return field object with given name, or null
-     */
-    public Field containsField( String name ) {
-        for (Iterator e = field_vec.iterator(); e.hasNext();) {
-            Field f = (Field) e.next();
-            if (f.getName().equals(name)) {
-                return f;
-            }
-        }
-        return null;
-    }
-
-
-    /** @return method object with given name and signature, or null
-     */
-    public Method containsMethod( String name, String signature ) {
-        for (Iterator e = method_vec.iterator(); e.hasNext();) {
-            Method m = (Method) e.next();
-            if (m.getName().equals(name) && m.getSignature().equals(signature)) {
-                return m;
-            }
-        }
-        return null;
-    }
-
-
-    /**
-     * Remove an attribute from this class.
-     * @param a attribute to remove
-     */
-    public void removeAttribute( Attribute a ) {
-        attribute_vec.remove(a);
-    }
-
-
-    /**
-     * Remove a method from this class.
-     * @param m method to remove
-     */
-    public void removeMethod( Method m ) {
-        method_vec.remove(m);
-    }
-
-
-    /** Replace given method with new one. If the old one does not exist
-     * add the new_ method to the class anyway.
-     */
-    public void replaceMethod( Method old, Method new_ ) {
-        if (new_ == null) {
-            throw new ClassGenException("Replacement method must not be null");
-        }
-        int i = method_vec.indexOf(old);
-        if (i < 0) {
-            method_vec.add(new_);
-        } else {
-            method_vec.set(i, new_);
-        }
-    }
-
-
-    /** Replace given field with new one. If the old one does not exist
-     * add the new_ field to the class anyway.
-     */
-    public void replaceField( Field old, Field new_ ) {
-        if (new_ == null) {
-            throw new ClassGenException("Replacement method must not be null");
-        }
-        int i = field_vec.indexOf(old);
-        if (i < 0) {
-            field_vec.add(new_);
-        } else {
-            field_vec.set(i, new_);
-        }
-    }
-
-
-    /**
-     * Remove a field to this class.
-     * @param f field to remove
-     */
-    public void removeField( Field f ) {
-        field_vec.remove(f);
-    }
 
 
+    
+    
     public String getClassName() {
         return class_name;
     }
 
 
-    public String getSuperclassName() {
-        return super_class_name;
-    }
+    
 
 
-    public String getFileName() {
-        return file_name;
-    }
+    
 
 
-    public void setClassName( String name ) {
-        class_name = name.replace('/', '.');
-        class_name_index = cp.addClass(name);
-    }
+    
 
 
-    public void setSuperclassName( String name ) {
-        super_class_name = name.replace('/', '.');
-        superclass_name_index = cp.addClass(name);
-    }
+    
 
 
-    public Method[] getMethods() {
-        return (Method[]) method_vec.toArray(new Method[method_vec.size()]);
-    }
+    
 
 
-    public void setMethods( Method[] methods ) {
-        method_vec.clear();
-        for (int m = 0; m < methods.length; m++) {
-            addMethod(methods[m]);
-        }
-    }
+    
 
 
-    public void setMethodAt( Method method, int pos ) {
-        method_vec.set(pos, method);
-    }
+    
 
 
-    public Method getMethodAt( int pos ) {
-        return (Method) method_vec.get(pos);
-    }
+    
 
 
-    public String[] getInterfaceNames() {
-        int size = interface_vec.size();
-        String[] interfaces = new String[size];
-        interface_vec.toArray(interfaces);
-        return interfaces;
-    }
+    
 
 
-    public int[] getInterfaces() {
-        int size = interface_vec.size();
-        int[] interfaces = new int[size];
-        for (int i = 0; i < size; i++) {
-            interfaces[i] = cp.addClass((String) interface_vec.get(i));
-        }
-        return interfaces;
-    }
+    
 
 
-    public Field[] getFields() {
-        return (Field[]) field_vec.toArray(new Field[field_vec.size()]);
-    }
+    
 
 
-    public Attribute[] getAttributes() {
-        return (Attribute[]) attribute_vec.toArray(new Attribute[attribute_vec.size()]);
-    }
     
-    //  J5TODO: Should we make calling unpackAnnotations() lazy and put it in here?
-    public AnnotationEntryGen[] getAnnotationEntries() {
-    	return (AnnotationEntryGen[]) annotation_vec.toArray(new AnnotationEntryGen[annotation_vec.size()]);
-    }
+    
+    
 
 
-    public ConstantPoolGen getConstantPool() {
-        return cp;
-    }
+    
 
 
-    public void setConstantPool( ConstantPoolGen constant_pool ) {
-        cp = constant_pool;
-    }
+    
 
 
-    public void setClassNameIndex( int class_name_index ) {
-        this.class_name_index = class_name_index;
-        class_name = cp.getConstantPool().getConstantString(class_name_index,
-                Constants.CONSTANT_Class).replace('/', '.');
-    }
+    
 
 
-    public void setSuperclassNameIndex( int superclass_name_index ) {
-        this.superclass_name_index = superclass_name_index;
-        super_class_name = cp.getConstantPool().getConstantString(superclass_name_index,
-                Constants.CONSTANT_Class).replace('/', '.');
-    }
+    
 
 
-    public int getSuperclassNameIndex() {
-        return superclass_name_index;
-    }
+    
 
 
-    public int getClassNameIndex() {
-        return class_name_index;
-    }
+    
 
     private ArrayList observers;
 
 
-    /** Add observer for this object.
-     */
-    public void addObserver( ClassObserver o ) {
-        if (observers == null) {
-            observers = new ArrayList();
-        }
-        observers.add(o);
-    }
+    
 
 
-    /** Remove observer for this object.
-     */
-    public void removeObserver( ClassObserver o ) {
-        if (observers != null) {
-            observers.remove(o);
-        }
-    }
+    
 
 
-    /** Call notify() method on all observers. This method is not called
-     * automatically whenever the state has changed, but has to be
-     * called by the user after he has finished editing the object.
-     */
-    public void update() {
-        if (observers != null) {
-            for (Iterator e = observers.iterator(); e.hasNext();) {
-                ((ClassObserver) e.next()).notify(this);
-            }
-        }
-    }
+    
 
 
     public Object clone() {
@@ -571,20 +153,10 @@
     }
 
 
-    /**
-     * @return Comparison strategy object
-     */
-    public static BCELComparator getComparator() {
-        return _cmp;
-    }
+    
 
 
-    /**
-     * @param comparator Comparison strategy object
-     */
-    public static void setComparator( BCELComparator comparator ) {
-        _cmp = comparator;
-    }
+    
 
 
     /**

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassGenException.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassGenException.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassGenException.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ClassGenException.java Sat Dec  5 23:22:46 2009
@@ -34,7 +34,5 @@
         super(s);
     }
     
-    public ClassGenException(String s, Throwable initCause) {
-    	super(s, initCause);
-    }
+    
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/CodeExceptionGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/CodeExceptionGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/CodeExceptionGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/CodeExceptionGen.java Sat Dec  5 23:22:46 2009
@@ -38,7 +38,6 @@
     private InstructionHandle start_pc;
     private InstructionHandle end_pc;
     private InstructionHandle handler_pc;
-    private ObjectType catch_type;
 
 
     /**
@@ -55,24 +54,10 @@
         setStartPC(start_pc);
         setEndPC(end_pc);
         setHandlerPC(handler_pc);
-        this.catch_type = catch_type;
     }
 
 
-    /**
-     * Get CodeException object.<BR>
-     *
-     * This relies on that the instruction list has already been dumped
-     * to byte code or or that the `setPositions' methods has been
-     * called for the instruction list.
-     *
-     * @param cp constant pool
-     */
-    public CodeException getCodeException( ConstantPoolGen cp ) {
-        return new CodeException(start_pc.getPosition(), end_pc.getPosition()
-                + end_pc.getInstruction().getLength(), handler_pc.getPosition(),
-                (catch_type == null) ? 0 : cp.addClass(catch_type));
-    }
+    
 
 
     /* Set start of handler 
@@ -102,70 +87,25 @@
     }
 
 
-    /**
-     * @param old_ih old target, either start or end
-     * @param new_ih new target
-     */
-    public void updateTarget( InstructionHandle old_ih, InstructionHandle new_ih ) {
-        boolean targeted = false;
-        if (start_pc == old_ih) {
-            targeted = true;
-            setStartPC(new_ih);
-        }
-        if (end_pc == old_ih) {
-            targeted = true;
-            setEndPC(new_ih);
-        }
-        if (handler_pc == old_ih) {
-            targeted = true;
-            setHandlerPC(new_ih);
-        }
-        if (!targeted) {
-            throw new ClassGenException("Not targeting " + old_ih + ", but {" + start_pc + ", "
-                    + end_pc + ", " + handler_pc + "}");
-        }
-    }
+    
 
 
-    /**
-     * @return true, if ih is target of this handler
-     */
-    public boolean containsTarget( InstructionHandle ih ) {
-        return (start_pc == ih) || (end_pc == ih) || (handler_pc == ih);
-    }
+    
 
 
-    /** Sets the type of the Exception to catch. Set 'null' for ANY. */
-    public void setCatchType( ObjectType catch_type ) {
-        this.catch_type = catch_type;
-    }
+    
 
 
-    /** Gets the type of the Exception to catch, 'null' for ANY. */
-    public ObjectType getCatchType() {
-        return catch_type;
-    }
+    
 
 
-    /** @return start of handled region (inclusive)
-     */
-    public InstructionHandle getStartPC() {
-        return start_pc;
-    }
+    
 
 
-    /** @return end of handled region (inclusive)
-     */
-    public InstructionHandle getEndPC() {
-        return end_pc;
-    }
+    
 
 
-    /** @return start of handler
-     */
-    public InstructionHandle getHandlerPC() {
-        return handler_pc;
-    }
+    
 
 
     public String toString() {

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ConstantPoolGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ConstantPoolGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ConstantPoolGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ConstantPoolGen.java Sat Dec  5 23:22:46 2009
@@ -18,9 +18,7 @@
 
 import java.util.HashMap;
 import java.util.Map;
-import org.apache.tomcat.util.bcel.Constants;
 import org.apache.tomcat.util.bcel.classfile.Constant;
-import org.apache.tomcat.util.bcel.classfile.ConstantCP;
 import org.apache.tomcat.util.bcel.classfile.ConstantClass;
 import org.apache.tomcat.util.bcel.classfile.ConstantDouble;
 import org.apache.tomcat.util.bcel.classfile.ConstantFieldref;
@@ -69,98 +67,10 @@
     }
 
 
-    /**
-     * Initialize with given array of constants.
-     *
-     * @param cs array of given constants, new ones will be appended
-     */
-    public ConstantPoolGen(Constant[] cs) {
-    	StringBuffer sb = new StringBuffer(256);
-        
-        size = Math.max(256, cs.length + 64);
-        constants = new Constant[size];
-        
-        System.arraycopy(cs, 0, constants, 0, cs.length);
-        if (cs.length > 0) {
-            index = cs.length;
-        }
-    	
-    	
-        for (int i = 1; i < index; i++) {
-            Constant c = constants[i];
-            if (c instanceof ConstantString) {
-                ConstantString s = (ConstantString) c;
-                ConstantUtf8 u8 = (ConstantUtf8) constants[s.getStringIndex()];
-                String key = u8.getBytes();
-                if (!string_table.containsKey(key)) {
-                    string_table.put(key, new Index(i));
-                }
-            } else if (c instanceof ConstantClass) {
-                ConstantClass s = (ConstantClass) c;
-                ConstantUtf8 u8 = (ConstantUtf8) constants[s.getNameIndex()];
-                String key = u8.getBytes();
-                if (!class_table.containsKey(key)) {
-                    class_table.put(key, new Index(i));
-                }
-            } else if (c instanceof ConstantNameAndType) {
-                ConstantNameAndType n = (ConstantNameAndType) c;
-                ConstantUtf8 u8 = (ConstantUtf8) constants[n.getNameIndex()];
-                ConstantUtf8 u8_2 = (ConstantUtf8) constants[n.getSignatureIndex()];
-                
-                sb.append(u8.getBytes());
-                sb.append(NAT_DELIM);
-                sb.append(u8_2.getBytes());
-                String key = sb.toString();
-                sb.delete(0, sb.length());
-                
-                if (!n_a_t_table.containsKey(key)) {
-                    n_a_t_table.put(key, new Index(i));
-                }
-            } else if (c instanceof ConstantUtf8) {
-                ConstantUtf8 u = (ConstantUtf8) c;
-                String key = u.getBytes();
-                if (!utf8_table.containsKey(key)) {
-                    utf8_table.put(key, new Index(i));
-                }
-            } else if (c instanceof ConstantCP) {
-                ConstantCP m = (ConstantCP) c;
-                ConstantClass clazz = (ConstantClass) constants[m.getClassIndex()];
-                ConstantNameAndType n = (ConstantNameAndType) constants[m.getNameAndTypeIndex()];
-                ConstantUtf8 u8 = (ConstantUtf8) constants[clazz.getNameIndex()];
-                String class_name = u8.getBytes().replace('/', '.');
-                u8 = (ConstantUtf8) constants[n.getNameIndex()];
-                String method_name = u8.getBytes();
-                u8 = (ConstantUtf8) constants[n.getSignatureIndex()];
-                String signature = u8.getBytes();
-                String delim = METHODREF_DELIM;
-                if (c instanceof ConstantInterfaceMethodref) {
-                    delim = IMETHODREF_DELIM;
-                } else if (c instanceof ConstantFieldref) {
-                    delim = FIELDREF_DELIM;
-                }
-                
-                sb.append(class_name);
-                sb.append(delim);
-                sb.append(method_name);
-                sb.append(delim);
-                sb.append(signature);
-                String key = sb.toString();
-                sb.delete(0, sb.length());
-                
-                if (!cp_table.containsKey(key)) {
-                    cp_table.put(key, new Index(i));
-                }
-            }
-        }
-    }
+    
 
 
-    /**
-     * Initialize with given constant pool.
-     */
-    public ConstantPoolGen(ConstantPool cp) {
-        this(cp.getConstantPool());
-    }
+    
 
 
     /**
@@ -273,16 +183,7 @@
     }
 
 
-    /**
-     * Add a reference to an array class (e.g. String[][]) as needed by MULTIANEWARRAY
-     * instruction, e.g. to the ConstantPool.
-     *
-     * @param type type of array class
-     * @return index of entry
-     */
-    public int addArrayClass( ArrayType type ) {
-        return addClass_(type.getSignature());
-    }
+    
 
 
     /** 
@@ -531,9 +432,7 @@
     }
 
 
-    public int lookupMethodref( MethodGen method ) {
-        return lookupMethodref(method.getClassName(), method.getName(), method.getSignature());
-    }
+    
 
 
     /**
@@ -563,9 +462,7 @@
     }
 
 
-    public int addMethodref( MethodGen method ) {
-        return addMethodref(method.getClassName(), method.getName(), method.getSignature());
-    }
+    
 
 
     /** 
@@ -583,10 +480,7 @@
     }
 
 
-    public int lookupInterfaceMethodref( MethodGen method ) {
-        return lookupInterfaceMethodref(method.getClassName(), method.getName(), method
-                .getSignature());
-    }
+    
 
 
     /**
@@ -616,9 +510,7 @@
     }
 
 
-    public int addInterfaceMethodref( MethodGen method ) {
-        return addInterfaceMethodref(method.getClassName(), method.getName(), method.getSignature());
-    }
+    
 
 
     /** 
@@ -673,15 +565,7 @@
     }
 
 
-    /**
-     * Use with care!
-     *
-     * @param i index in constant pool
-     * @param c new constant pool entry at index i
-     */
-    public void setConstant( int i, Constant c ) {
-        constants[i] = c;
-    }
+    
 
 
     /**
@@ -692,22 +576,10 @@
     }
 
 
-    /**
-     * @return current size of constant pool
-     */
-    public int getSize() {
-        return index;
-    }
+    
 
 
-    /**
-     * @return constant pool with proper length
-     */
-    public ConstantPool getFinalConstantPool() {
-        Constant[] cs = new Constant[index];
-        System.arraycopy(constants, 0, cs, 0, index);
-        return new ConstantPool(cs);
-    }
+    
 
 
     /**
@@ -722,62 +594,5 @@
     }
 
 
-    /** Import constant from another ConstantPool and return new index.
-     */
-    public int addConstant( Constant c, ConstantPoolGen cp ) {
-        Constant[] constants = cp.getConstantPool().getConstantPool();
-        switch (c.getTag()) {
-            case Constants.CONSTANT_String: {
-                ConstantString s = (ConstantString) c;
-                ConstantUtf8 u8 = (ConstantUtf8) constants[s.getStringIndex()];
-                return addString(u8.getBytes());
-            }
-            case Constants.CONSTANT_Class: {
-                ConstantClass s = (ConstantClass) c;
-                ConstantUtf8 u8 = (ConstantUtf8) constants[s.getNameIndex()];
-                return addClass(u8.getBytes());
-            }
-            case Constants.CONSTANT_NameAndType: {
-                ConstantNameAndType n = (ConstantNameAndType) c;
-                ConstantUtf8 u8 = (ConstantUtf8) constants[n.getNameIndex()];
-                ConstantUtf8 u8_2 = (ConstantUtf8) constants[n.getSignatureIndex()];
-                return addNameAndType(u8.getBytes(), u8_2.getBytes());
-            }
-            case Constants.CONSTANT_Utf8:
-                return addUtf8(((ConstantUtf8) c).getBytes());
-            case Constants.CONSTANT_Double:
-                return addDouble(((ConstantDouble) c).getBytes());
-            case Constants.CONSTANT_Float:
-                return addFloat(((ConstantFloat) c).getBytes());
-            case Constants.CONSTANT_Long:
-                return addLong(((ConstantLong) c).getBytes());
-            case Constants.CONSTANT_Integer:
-                return addInteger(((ConstantInteger) c).getBytes());
-            case Constants.CONSTANT_InterfaceMethodref:
-            case Constants.CONSTANT_Methodref:
-            case Constants.CONSTANT_Fieldref: {
-                ConstantCP m = (ConstantCP) c;
-                ConstantClass clazz = (ConstantClass) constants[m.getClassIndex()];
-                ConstantNameAndType n = (ConstantNameAndType) constants[m.getNameAndTypeIndex()];
-                ConstantUtf8 u8 = (ConstantUtf8) constants[clazz.getNameIndex()];
-                String class_name = u8.getBytes().replace('/', '.');
-                u8 = (ConstantUtf8) constants[n.getNameIndex()];
-                String name = u8.getBytes();
-                u8 = (ConstantUtf8) constants[n.getSignatureIndex()];
-                String signature = u8.getBytes();
-                switch (c.getTag()) {
-                    case Constants.CONSTANT_InterfaceMethodref:
-                        return addInterfaceMethodref(class_name, name, signature);
-                    case Constants.CONSTANT_Methodref:
-                        return addMethodref(class_name, name, signature);
-                    case Constants.CONSTANT_Fieldref:
-                        return addFieldref(class_name, name, signature);
-                    default: // Never reached
-                        throw new RuntimeException("Unknown constant type " + c);
-                }
-            }
-            default: // Never reached
-                throw new RuntimeException("Unknown constant type " + c);
-        }
-    }
+    
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ElementValueGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ElementValueGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ElementValueGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ElementValueGen.java Sat Dec  5 23:22:46 2009
@@ -1,11 +1,9 @@
 package org.apache.tomcat.util.bcel.generic;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.apache.tomcat.util.bcel.classfile.AnnotationElementValue;
-import org.apache.tomcat.util.bcel.classfile.AnnotationEntry;
 import org.apache.tomcat.util.bcel.classfile.ArrayElementValue;
 import org.apache.tomcat.util.bcel.classfile.ClassElementValue;
 import org.apache.tomcat.util.bcel.classfile.ElementValue;
@@ -29,10 +27,7 @@
 	 */
 	public abstract ElementValue getElementValue();
 
-	public int getElementValueType()
-	{
-		return type;
-	}
+	
 
 	public abstract String stringifyValue();
 
@@ -64,64 +59,7 @@
 
 	public static final int PRIMITIVE_BOOLEAN = 'Z';
 
-	public static ElementValueGen readElementValue(DataInputStream dis,
-			ConstantPoolGen cpGen) throws IOException
-	{
-		int type = dis.readUnsignedByte();
-		switch (type)
-		{
-		case 'B': // byte
-			return new SimpleElementValueGen(PRIMITIVE_BYTE, dis
-					.readUnsignedShort(), cpGen);
-		case 'C': // char
-			return new SimpleElementValueGen(PRIMITIVE_CHAR, dis
-					.readUnsignedShort(), cpGen);
-		case 'D': // double
-			return new SimpleElementValueGen(PRIMITIVE_DOUBLE, dis
-					.readUnsignedShort(), cpGen);
-		case 'F': // float
-			return new SimpleElementValueGen(PRIMITIVE_FLOAT, dis
-					.readUnsignedShort(), cpGen);
-		case 'I': // int
-			return new SimpleElementValueGen(PRIMITIVE_INT, dis
-					.readUnsignedShort(), cpGen);
-		case 'J': // long
-			return new SimpleElementValueGen(PRIMITIVE_LONG, dis
-					.readUnsignedShort(), cpGen);
-		case 'S': // short
-			return new SimpleElementValueGen(PRIMITIVE_SHORT, dis
-					.readUnsignedShort(), cpGen);
-		case 'Z': // boolean
-			return new SimpleElementValueGen(PRIMITIVE_BOOLEAN, dis
-					.readUnsignedShort(), cpGen);
-		case 's': // String
-			return new SimpleElementValueGen(STRING, dis.readUnsignedShort(),
-					cpGen);
-		case 'e': // Enum constant
-			return new EnumElementValueGen(dis.readUnsignedShort(), dis
-					.readUnsignedShort(), cpGen);
-		case 'c': // Class
-			return new ClassElementValueGen(dis.readUnsignedShort(), cpGen);
-		case '@': // Annotation
-			// TODO: isRuntimeVisible ??????????
-			// FIXME
-			return new AnnotationElementValueGen(ANNOTATION,
-					new AnnotationEntryGen(AnnotationEntry.read(dis, cpGen
-							.getConstantPool(), true), cpGen, false), cpGen);
-		case '[': // Array
-			int numArrayVals = dis.readUnsignedShort();
-			ElementValue[] evalues = new ElementValue[numArrayVals];
-			for (int j = 0; j < numArrayVals; j++)
-			{
-				evalues[j] = ElementValue.readElementValue(dis, cpGen
-						.getConstantPool());
-			}
-			return new ArrayElementValueGen(ARRAY, evalues, cpGen);
-		default:
-			throw new RuntimeException(
-					"Unexpected element value kind in annotation: " + type);
-		}
-	}
+	
 
 	protected ConstantPoolGen getConstantPool()
 	{

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ElementValuePairGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ElementValuePairGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ElementValuePairGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ElementValuePairGen.java Sat Dec  5 23:22:46 2009
@@ -47,21 +47,9 @@
 				.getConstantPool());
 	}
 
-	protected ElementValuePairGen(int idx, ElementValueGen value,
-			ConstantPoolGen cpool)
-	{
-		this.nameIdx = idx;
-		this.value = value;
-		this.cpool = cpool;
-	}
+	
 
-	public ElementValuePairGen(String name, ElementValueGen value,
-			ConstantPoolGen cpool)
-	{
-		this.nameIdx = cpool.addUtf8(name);
-		this.value = value;
-		this.cpool = cpool;
-	}
+	
 
 	protected void dump(DataOutputStream dos) throws IOException
 	{
@@ -69,10 +57,7 @@
 		value.dump(dos);
 	}
 
-	public int getNameIndex()
-	{
-		return nameIdx;
-	}
+	
 
 	public final String getNameString()
 	{
@@ -80,10 +65,7 @@
 		return ((ConstantUtf8) cpool.getConstant(nameIdx)).getBytes();
 	}
 
-	public final ElementValueGen getValue()
-	{
-		return value;
-	}
+	
 
 	public String toString()
 	{

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/EnumElementValueGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/EnumElementValueGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/EnumElementValueGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/EnumElementValueGen.java Sat Dec  5 23:22:46 2009
@@ -13,21 +13,7 @@
 
 	private int valueIdx;
 
-	/**
-	 * This ctor assumes the constant pool already contains the right type and
-	 * value - as indicated by typeIdx and valueIdx. This ctor is used for
-	 * deserialization
-	 */
-	protected EnumElementValueGen(int typeIdx, int valueIdx,
-			ConstantPoolGen cpool)
-	{
-		super(ElementValueGen.ENUM_CONSTANT, cpool);
-		if (type != ENUM_CONSTANT)
-			throw new RuntimeException(
-					"Only element values of type enum can be built with this ctor - type specified: " + type);
-		this.typeIdx = typeIdx;
-		this.valueIdx = valueIdx;
-	}
+	
 
 	/**
 	 * Return immutable variant of this EnumElementValue
@@ -40,12 +26,7 @@
 				.getConstantPool());
 	}
 
-	public EnumElementValueGen(ObjectType t, String value, ConstantPoolGen cpool)
-	{
-		super(ElementValueGen.ENUM_CONSTANT, cpool);
-		typeIdx = cpool.addUtf8(t.getSignature());// was addClass(t);
-		valueIdx = cpool.addUtf8(value);// was addString(value);
-	}
+	
 
 	public EnumElementValueGen(EnumElementValue value, ConstantPoolGen cpool,
 			boolean copyPoolEntries)
@@ -107,13 +88,7 @@
 		// ((ConstantUtf8)getConstantPool().getConstant(cu8.getStringIndex())).getBytes();
 	}
 
-	public int getValueIndex()
-	{
-		return valueIdx;
-	}
+	
 
-	public int getTypeIndex()
-	{
-		return typeIdx;
-	}
+	
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ExceptionThrower.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ExceptionThrower.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ExceptionThrower.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/ExceptionThrower.java Sat Dec  5 23:22:46 2009
@@ -38,5 +38,5 @@
  */
 public interface ExceptionThrower {
 
-    public java.lang.Class[] getExceptions();
+    
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldGen.java Sat Dec  5 23:22:46 2009
@@ -16,17 +16,7 @@
  */
 package org.apache.tomcat.util.bcel.generic;
 
-import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
-import org.apache.tomcat.util.bcel.Constants;
-import org.apache.tomcat.util.bcel.classfile.AnnotationEntry;
-import org.apache.tomcat.util.bcel.classfile.Annotations;
-import org.apache.tomcat.util.bcel.classfile.Attribute;
-import org.apache.tomcat.util.bcel.classfile.Constant;
-import org.apache.tomcat.util.bcel.classfile.ConstantObject;
-import org.apache.tomcat.util.bcel.classfile.ConstantPool;
-import org.apache.tomcat.util.bcel.classfile.ConstantValue;
 import org.apache.tomcat.util.bcel.classfile.Field;
 import org.apache.tomcat.util.bcel.classfile.Utility;
 import org.apache.tomcat.util.bcel.util.BCELComparator;
@@ -60,199 +50,10 @@
     };
 
 
-    /**
-     * Declare a field. If it is static (isStatic() == true) and has a
-     * basic type like int or String it may have an initial value
-     * associated with it as defined by setInitValue().
-     *
-     * @param access_flags access qualifiers
-     * @param type  field type
-     * @param name field name
-     * @param cp constant pool
-     */
-    public FieldGen(int access_flags, Type type, String name, ConstantPoolGen cp) {
-        setAccessFlags(access_flags);
-        setType(type);
-        setName(name);
-        setConstantPool(cp);
-    }
-
-
-    /**
-     * Instantiate from existing field.
-     *
-     * @param field Field object
-     * @param cp constant pool (must contain the same entries as the field's constant pool)
-     */
-    public FieldGen(Field field, ConstantPoolGen cp) {
-        this(field.getAccessFlags(), Type.getType(field.getSignature()), field.getName(), cp);
-        Attribute[] attrs = field.getAttributes();
-        for (int i = 0; i < attrs.length; i++) {
-            if (attrs[i] instanceof ConstantValue) {
-                setValue(((ConstantValue) attrs[i]).getConstantValueIndex());
-            } else if (attrs[i] instanceof Annotations) {
-            	Annotations runtimeAnnotations = (Annotations)attrs[i];
-        		AnnotationEntry[] annotationEntries = runtimeAnnotations.getAnnotationEntries();
-        		for (int j = 0; j < annotationEntries.length; j++) {
-        			AnnotationEntry element = annotationEntries[j];
-        			addAnnotationEntry(new AnnotationEntryGen(element,cp,false));
-        		}
-            } else {
-                addAttribute(attrs[i]);
-            }
-        }
-    }
-
-
-    private void setValue( int index ) {
-        ConstantPool cp = this.cp.getConstantPool();
-        Constant c = cp.getConstant(index);
-        value = ((ConstantObject) c).getConstantValue(cp);
-    }
-
-
-    /**
-     * Set (optional) initial value of field, otherwise it will be set to null/0/false
-     * by the JVM automatically.
-     */
-    public void setInitValue( String str ) {
-        checkType(new ObjectType("java.lang.String"));
-        if (str != null) {
-            value = str;
-        }
-    }
-
-
-    public void setInitValue( long l ) {
-        checkType(Type.LONG);
-        if (l != 0L) {
-            value = new Long(l);
-        }
-    }
-
-
-    public void setInitValue( int i ) {
-        checkType(Type.INT);
-        if (i != 0) {
-            value = new Integer(i);
-        }
-    }
-
-
-    public void setInitValue( short s ) {
-        checkType(Type.SHORT);
-        if (s != 0) {
-            value = new Integer(s);
-        }
-    }
-
-
-    public void setInitValue( char c ) {
-        checkType(Type.CHAR);
-        if (c != 0) {
-            value = new Integer(c);
-        }
-    }
-
-
-    public void setInitValue( byte b ) {
-        checkType(Type.BYTE);
-        if (b != 0) {
-            value = new Integer(b);
-        }
-    }
-
-
-    public void setInitValue( boolean b ) {
-        checkType(Type.BOOLEAN);
-        if (b) {
-            value = new Integer(1);
-        }
-    }
-
-
-    public void setInitValue( float f ) {
-        checkType(Type.FLOAT);
-        if (f != 0.0) {
-            value = new Float(f);
-        }
-    }
-
-
-    public void setInitValue( double d ) {
-        checkType(Type.DOUBLE);
-        if (d != 0.0) {
-            value = new Double(d);
-        }
-    }
-
-
-    /** Remove any initial value.
-     */
-    public void cancelInitValue() {
-        value = null;
-    }
-
-
-    private void checkType( Type atype ) {
-        if (type == null) {
-            throw new ClassGenException("You haven't defined the type of the field yet");
-        }
-        if (!isFinal()) {
-            throw new ClassGenException("Only final fields may have an initial value!");
-        }
-        if (!type.equals(atype)) {
-            throw new ClassGenException("Types are not compatible: " + type + " vs. " + atype);
-        }
-    }
+    
 
 
-    /**
-     * Get field object after having set up all necessary values.
-     */
-    public Field getField() {
-        String signature = getSignature();
-        int name_index = cp.addUtf8(name);
-        int signature_index = cp.addUtf8(signature);
-        if (value != null) {
-            checkType(type);
-            int index = addConstant();
-            addAttribute(new ConstantValue(cp.addUtf8("ConstantValue"), 2, index, cp
-                    .getConstantPool()));
-        }
-        addAnnotationsAsAttribute(cp);
-        return new Field(access_flags, name_index, signature_index, getAttributes(), cp
-                .getConstantPool());
-    }
     
-    private void addAnnotationsAsAttribute(ConstantPoolGen cp) {
-      	Attribute[] attrs = Utility.getAnnotationAttributes(cp,annotation_vec);
-        for (int i = 0; i < attrs.length; i++) {
-    		addAttribute(attrs[i]);
-    	}
-      }
-
-
-    private int addConstant() {
-        switch (type.getType()) {
-            case Constants.T_INT:
-            case Constants.T_CHAR:
-            case Constants.T_BYTE:
-            case Constants.T_BOOLEAN:
-            case Constants.T_SHORT:
-                return cp.addInteger(((Integer) value).intValue());
-            case Constants.T_FLOAT:
-                return cp.addFloat(((Float) value).floatValue());
-            case Constants.T_DOUBLE:
-                return cp.addDouble(((Double) value).doubleValue());
-            case Constants.T_LONG:
-                return cp.addLong(((Long) value).longValue());
-            case Constants.T_REFERENCE:
-                return cp.addString(((String) value));
-            default:
-                throw new RuntimeException("Oops: Unhandled : " + type.getType());
-        }
-    }
 
 
     public String getSignature() {
@@ -262,36 +63,13 @@
     private List observers;
 
 
-    /** Add observer for this object.
-     */
-    public void addObserver( FieldObserver o ) {
-        if (observers == null) {
-            observers = new ArrayList();
-        }
-        observers.add(o);
-    }
+    
 
 
-    /** Remove observer for this object.
-     */
-    public void removeObserver( FieldObserver o ) {
-        if (observers != null) {
-            observers.remove(o);
-        }
-    }
+    
 
 
-    /** Call notify() method on all observers. This method is not called
-     * automatically whenever the state has changed, but has to be
-     * called by the user after he has finished editing the object.
-     */
-    public void update() {
-        if (observers != null) {
-            for (Iterator e = observers.iterator(); e.hasNext();) {
-                ((FieldObserver) e.next()).notify(this);
-            }
-        }
-    }
+    
 
 
     public String getInitValue() {
@@ -325,29 +103,13 @@
     }
 
 
-    /** @return deep copy of this field
-     */
-    public FieldGen copy( ConstantPoolGen cp ) {
-        FieldGen fg = (FieldGen) clone();
-        fg.setConstantPool(cp);
-        return fg;
-    }
+    
 
 
-    /**
-     * @return Comparison strategy object
-     */
-    public static BCELComparator getComparator() {
-        return _cmp;
-    }
+    
 
 
-    /**
-     * @param comparator Comparison strategy object
-     */
-    public static void setComparator( BCELComparator comparator ) {
-        _cmp = comparator;
-    }
+    
 
 
     /**

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldGenOrMethodGen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldGenOrMethodGen.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldGenOrMethodGen.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldGenOrMethodGen.java Sat Dec  5 23:22:46 2009
@@ -50,9 +50,7 @@
     }
 
 
-    public Type getType() {
-        return type;
-    }
+    
 
 
     /** @return name of method/field.
@@ -67,9 +65,7 @@
     }
 
 
-    public ConstantPoolGen getConstantPool() {
-        return cp;
-    }
+    
 
 
     public void setConstantPool( ConstantPoolGen cp ) {
@@ -89,36 +85,17 @@
         attribute_vec.add(a);
     }
     
-    public void addAnnotationEntry(AnnotationEntryGen ag)
-	{
-		annotation_vec.add(ag);
-	}
+    
 
 
-    /**
-     * Remove an attribute.
-     */
-    public void removeAttribute( Attribute a ) {
-        attribute_vec.remove(a);
-    }
     
-    public void removeAnnotationEntry(AnnotationEntryGen ag)
-	{
-		annotation_vec.remove(ag);
-	}
+    
+    
 
 
-    /**
-     * Remove all attributes.
-     */
-    public void removeAttributes() {
-        attribute_vec.clear();
-    }
     
-    public void removeAnnotationEntries()
-	{
-		annotation_vec.clear();
-	}
+    
+    
 
 
     /**
@@ -130,11 +107,7 @@
         return attributes;
     }
     
-    public AnnotationEntryGen[] getAnnotationEntries() {
-    	AnnotationEntryGen[] annotations = new AnnotationEntryGen[annotation_vec.size()];
-      	annotation_vec.toArray(annotations);
-      	return annotations;
-      }
+    
 
 
     /** @return signature of method/field.

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldInstruction.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldInstruction.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldInstruction.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldInstruction.java Sat Dec  5 23:22:46 2009
@@ -34,12 +34,7 @@
     }
 
 
-    /**
-     * @param index to constant pool
-     */
-    protected FieldInstruction(short opcode, int index) {
-        super(opcode, index);
-    }
+    
 
 
     /**
@@ -72,9 +67,5 @@
     }
 
 
-    /** @return name of referenced field.
-     */
-    public String getFieldName( ConstantPoolGen cpg ) {
-        return getName(cpg);
-    }
+    
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldOrMethod.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldOrMethod.java?rev=887610&r1=887609&r2=887610&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldOrMethod.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/generic/FieldOrMethod.java Sat Dec  5 23:22:46 2009
@@ -38,12 +38,7 @@
     }
 
 
-    /**
-     * @param index to constant pool
-     */
-    protected FieldOrMethod(short opcode, int index) {
-        super(opcode, index);
-    }
+    
 
 
     /** @return signature of referenced method/field.
@@ -56,14 +51,7 @@
     }
 
 
-    /** @return name of referenced method/field.
-     */
-    public String getName( ConstantPoolGen cpg ) {
-        ConstantPool cp = cpg.getConstantPool();
-        ConstantCP cmr = (ConstantCP) cp.getConstant(index);
-        ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
-        return ((ConstantUtf8) cp.getConstant(cnat.getNameIndex())).getBytes();
-    }
+    
 
 
     /** @return name of the referenced class/interface
@@ -88,41 +76,11 @@
     }
 
 
-    /** @return type of the referenced class/interface
-     * @deprecated If the instruction references an array class,
-     *    the ObjectType returned will be invalid.  Use
-     *    getReferenceType() instead.
-     */
-    public ObjectType getClassType( ConstantPoolGen cpg ) {
-        return new ObjectType(getClassName(cpg));
-    }
+    
 
 
-    /**
-     * Return the reference type representing the class, interface,
-     * or array class referenced by the instruction.
-     * @param cpg the ConstantPoolGen used to create the instruction
-     * @return an ObjectType (if the referenced class type is a class
-     *   or interface), or an ArrayType (if the referenced class
-     *   type is an array class)
-     */
-    public ReferenceType getReferenceType( ConstantPoolGen cpg ) {
-        ConstantPool cp = cpg.getConstantPool();
-        ConstantCP cmr = (ConstantCP) cp.getConstant(index);
-        String className = cp.getConstantString(cmr.getClassIndex(),
-                org.apache.tomcat.util.bcel.Constants.CONSTANT_Class);
-        if (className.startsWith("[")) {
-            return (ArrayType) Type.getType(className);
-        } else {
-            className = className.replace('/', '.');
-            return new ObjectType(className);
-        }
-    }
+    
 
 
-    /** @return type of the referenced class/interface
-     */
-    public ObjectType getLoadClassType( ConstantPoolGen cpg ) {
-        return getClassType(cpg);
-    }
+    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message