jakarta-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject svn commit: r1149459 [2/2] - in /jakarta/bcel/trunk/src: examples/ examples/Mini/ main/java/org/apache/bcel/ main/java/org/apache/bcel/classfile/ main/java/org/apache/bcel/generic/ main/java/org/apache/bcel/util/ main/java/org/apache/bcel/verifier/ mai...
Date Fri, 22 Jul 2011 04:34:39 GMT
Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java Fri Jul 22 04:34:27 2011
@@ -67,13 +67,13 @@ public class MethodGen extends FieldGenO
     private int max_stack;
     private InstructionList il;
     private boolean strip_attributes;
-    private List variable_vec = new ArrayList();
-    private List line_number_vec = new ArrayList();
-    private List exception_vec = new ArrayList();
-    private List throws_vec = new ArrayList();
-    private List code_attrs_vec = new ArrayList();
+    private List<LocalVariableGen> variable_vec = new ArrayList<LocalVariableGen>();
+    private List<LineNumberGen> line_number_vec = new ArrayList<LineNumberGen>();
+    private List<CodeExceptionGen> exception_vec = new ArrayList<CodeExceptionGen>();
+    private List<String> throws_vec = new ArrayList<String>();
+    private List<Attribute> code_attrs_vec = new ArrayList<Attribute>();
     
-    private List[] param_annotations; // Array of lists containing AnnotationGen objects
+    private List<AnnotationEntryGen>[] param_annotations; // Array of lists containing AnnotationGen objects
     private boolean hasParameterAnnotations = false;
     private boolean haveUnpackedParameterAnnotations = false;
     
@@ -469,7 +469,7 @@ public class MethodGen extends FieldGenO
         LineNumber[] ln = new LineNumber[size];
         try {
             for (int i = 0; i < size; i++) {
-                ln[i] = ((LineNumberGen) line_number_vec.get(i)).getLineNumber();
+                ln[i] = line_number_vec.get(i).getLineNumber();
             }
         } catch (ArrayIndexOutOfBoundsException e) {
         } // Never occurs
@@ -534,7 +534,7 @@ public class MethodGen extends FieldGenO
         CodeException[] c_exc = new CodeException[size];
         try {
             for (int i = 0; i < size; i++) {
-                CodeExceptionGen c = (CodeExceptionGen) exception_vec.get(i);
+                CodeExceptionGen c =  exception_vec.get(i);
                 c_exc[i] = c.getCodeException(cp);
             }
         } catch (ArrayIndexOutOfBoundsException e) {
@@ -587,7 +587,7 @@ public class MethodGen extends FieldGenO
         int[] ex = new int[size];
         try {
             for (int i = 0; i < size; i++) {
-                ex[i] = cp.addClass((String) throws_vec.get(i));
+                ex[i] = cp.addClass(throws_vec.get(i));
             }
         } catch (ArrayIndexOutOfBoundsException e) {
         }
@@ -813,7 +813,7 @@ public class MethodGen extends FieldGenO
 
 
     public Type[] getArgumentTypes() {
-        return (Type[]) arg_types.clone();
+        return arg_types.clone();
     }
 
 
@@ -833,7 +833,7 @@ public class MethodGen extends FieldGenO
 
 
     public String[] getArgumentNames() {
-        return (String[]) arg_names.clone();
+        return arg_names.clone();
     }
 
 
@@ -924,8 +924,8 @@ public class MethodGen extends FieldGenO
 
     static final class BranchStack {
 
-        Stack branchTargets = new Stack();
-        Hashtable visitedTargets = new Hashtable();
+        Stack<BranchTarget> branchTargets = new Stack<BranchTarget>();
+        Hashtable<InstructionHandle, BranchTarget> visitedTargets = new Hashtable<InstructionHandle, BranchTarget>();
 
 
         public void push( InstructionHandle target, int stackDepth ) {
@@ -938,7 +938,7 @@ public class MethodGen extends FieldGenO
 
         public BranchTarget pop() {
             if (!branchTargets.empty()) {
-                BranchTarget bt = (BranchTarget) branchTargets.pop();
+                BranchTarget bt = branchTargets.pop();
                 return bt;
             }
             return null;
@@ -1033,14 +1033,14 @@ public class MethodGen extends FieldGenO
         return maxStackDepth;
     }
 
-    private List observers;
+    private List<MethodObserver> observers;
 
 
     /** Add observer for this object.
      */
     public void addObserver( MethodObserver o ) {
         if (observers == null) {
-            observers = new ArrayList();
+            observers = new ArrayList<MethodObserver>();
         }
         observers.add(o);
     }
@@ -1061,8 +1061,8 @@ public class MethodGen extends FieldGenO
      */
     public void update() {
         if (observers != null) {
-            for (Iterator e = observers.iterator(); e.hasNext();) {
-                ((MethodObserver) e.next()).notify(this);
+            for (Iterator<MethodObserver> e = observers.iterator(); e.hasNext();) {
+                e.next().notify(this);
             }
         }
     }
@@ -1088,7 +1088,7 @@ public class MethodGen extends FieldGenO
         }
         
         if (throws_vec.size() > 0) {
-            for (Iterator e = throws_vec.iterator(); e.hasNext();) {
+            for (Iterator<String> e = throws_vec.iterator(); e.hasNext();) {
                 buf.append("\n\t\tthrows ").append(e.next());
             }
         }
@@ -1113,7 +1113,7 @@ public class MethodGen extends FieldGenO
     /**
      * Return a list of AnnotationGen objects representing parameter annotations
      */
-    public List getAnnotationsOnParameter(int i) {
+    public List<AnnotationEntryGen> getAnnotationsOnParameter(int i) {
     	ensureExistingParameterAnnotationsUnpacked();
     	if (!hasParameterAnnotations || i>arg_types.length) return null;
     	return param_annotations[i];
@@ -1145,7 +1145,7 @@ public class MethodGen extends FieldGenO
 				{
 					param_annotations = new List[arg_types.length];
 					for (int j = 0; j < arg_types.length; j++)
-						param_annotations[j] = new ArrayList();
+						param_annotations[j] = new ArrayList<AnnotationEntryGen>();
 				}
 				hasParameterAnnotations = true;
 				ParameterAnnotations rpa = (ParameterAnnotations) attribute;
@@ -1159,7 +1159,7 @@ public class MethodGen extends FieldGenO
 					ParameterAnnotationEntry immutableArray = rpa
 							.getParameterAnnotationEntries()[j];
 					// ... which needs transforming into an AnnotationGen[] ...
-					List mutable = makeMutableVersion(immutableArray.getAnnotationEntries());
+					List<AnnotationEntryGen> mutable = makeMutableVersion(immutableArray.getAnnotationEntries());
 					// ... then add these to any we already know about
 					param_annotations[j].addAll(mutable);
 				}
@@ -1172,9 +1172,9 @@ public class MethodGen extends FieldGenO
 		haveUnpackedParameterAnnotations = true;
 	}
 
-	private List /* AnnotationGen */makeMutableVersion(AnnotationEntry[] mutableArray)
+	private List<AnnotationEntryGen> makeMutableVersion(AnnotationEntry[] mutableArray)
 	{
-		List result = new ArrayList();
+		List<AnnotationEntryGen> result = new ArrayList<AnnotationEntryGen>();
 		for (int i = 0; i < mutableArray.length; i++)
 		{
 			result.add(new AnnotationEntryGen(mutableArray[i], getConstantPool(),
@@ -1192,14 +1192,14 @@ public class MethodGen extends FieldGenO
 			param_annotations = new List[arg_types.length];
 			hasParameterAnnotations = true;
 		}
-		List existingAnnotations = param_annotations[parameterIndex];
+		List<AnnotationEntryGen> existingAnnotations = param_annotations[parameterIndex];
 		if (existingAnnotations != null)
 		{
 			existingAnnotations.add(annotation);
 		}
 		else
 		{
-			List l = new ArrayList();
+			List<AnnotationEntryGen> l = new ArrayList<AnnotationEntryGen>();
 			l.add(annotation);
 			param_annotations[parameterIndex] = l;
 		}

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/NEW.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/NEW.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/NEW.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/NEW.java Fri Jul 22 04:34:27 2011
@@ -45,8 +45,8 @@ public class NEW extends CPInstruction i
     }
 
 
-    public Class[] getExceptions() {
-        Class[] cs = new Class[2 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length];
+    public Class<?>[] getExceptions() {
+        Class<?>[] cs = new Class[2 + 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 + 1] = ExceptionConstants.INSTANTIATION_ERROR;

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/NEWARRAY.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/NEWARRAY.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/NEWARRAY.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/NEWARRAY.java Fri Jul 22 04:34:27 2011
@@ -98,7 +98,7 @@ public class NEWARRAY extends Instructio
     }
 
 
-    public Class[] getExceptions() {
+    public Class<?>[] getExceptions() {
         return new Class[] {
             org.apache.bcel.ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION
         };

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/PUTFIELD.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/PUTFIELD.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/PUTFIELD.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/PUTFIELD.java Fri Jul 22 04:34:27 2011
@@ -52,8 +52,8 @@ public class PUTFIELD extends FieldInstr
     }
 
 
-    public Class[] getExceptions() {
-        Class[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
+    public Class<?>[] getExceptions() {
+        Class<?>[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
         System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0,
                 ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
         cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/PUTSTATIC.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/PUTSTATIC.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/PUTSTATIC.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/PUTSTATIC.java Fri Jul 22 04:34:27 2011
@@ -52,8 +52,8 @@ public class PUTSTATIC extends FieldInst
     }
 
 
-    public Class[] getExceptions() {
-        Class[] cs = new Class[1 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
+    public Class<?>[] getExceptions() {
+        Class<?>[] cs = new Class[1 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
         System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0,
                 ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
         cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ReturnInstruction.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ReturnInstruction.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ReturnInstruction.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ReturnInstruction.java Fri Jul 22 04:34:27 2011
@@ -68,7 +68,7 @@ public abstract class ReturnInstruction 
     }
 
 
-    public Class[] getExceptions() {
+    public Class<?>[] getExceptions() {
         return new Class[] {
             ExceptionConstants.ILLEGAL_MONITOR_STATE
         };

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/SWITCH.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/SWITCH.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/SWITCH.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/SWITCH.java Fri Jul 22 04:34:27 2011
@@ -49,8 +49,8 @@ public final class SWITCH implements Com
      * @param max_gap maximum gap that may between case branches
      */
     public SWITCH(int[] match, InstructionHandle[] targets, InstructionHandle target, int max_gap) {
-        this.match = (int[]) match.clone();
-        this.targets = (InstructionHandle[]) targets.clone();
+        this.match = match.clone();
+        this.targets = targets.clone();
         if ((match_length = match.length) < 2) {
             instruction = new TABLESWITCH(match, targets, target);
         } else {

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java Fri Jul 22 04:34:27 2011
@@ -149,20 +149,20 @@ public abstract class Type implements ja
         return buf.toString();
     }
 
-    private static final ThreadLocal consumed_chars = new ThreadLocal() {
+    private static final ThreadLocal<Integer> consumed_chars = new ThreadLocal<Integer>() {
 
-        protected Object initialValue() {
+        protected Integer initialValue() {
             return new Integer(0);
         }
     };//int consumed_chars=0; // Remember position in string, see getArgumentTypes
 
 
-    private static int unwrap( ThreadLocal tl ) {
-        return ((Integer) tl.get()).intValue();
+    private static int unwrap( ThreadLocal<Integer> tl ) {
+        return tl.get().intValue();
     }
 
 
-    private static void wrap( ThreadLocal tl, int value ) {
+    private static void wrap( ThreadLocal<Integer> tl, int value ) {
         tl.set(new Integer(value));
     }
 
@@ -225,7 +225,7 @@ public abstract class Type implements ja
      * @return array of argument types
      */
     public static Type[] getArgumentTypes( String signature ) {
-        List vec = new ArrayList();
+        List<Type> vec = new ArrayList<Type>();
         int index;
         Type[] types;
         try { // Read all declarations between for `(' and `)'
@@ -251,7 +251,7 @@ public abstract class Type implements ja
      * @param cl Java class
      * @return corresponding Type object
      */
-    public static Type getType( java.lang.Class cl ) {
+    public static Type getType( java.lang.Class<?> cl ) {
         if (cl == null) {
             throw new IllegalArgumentException("Class must not be null");
         }
@@ -295,7 +295,7 @@ public abstract class Type implements ja
      * @param classes an array of runtime class objects
      * @return array of corresponding Type objects
      */
-    public static Type[] getTypes( java.lang.Class[] classes ) {
+    public static Type[] getTypes( java.lang.Class<?>[] classes ) {
         Type[] ret = new Type[classes.length];
         for (int i = 0; i < ret.length; i++) {
             ret[i] = getType(classes[i]);
@@ -306,7 +306,7 @@ public abstract class Type implements ja
 
     public static String getSignature( java.lang.reflect.Method meth ) {
         StringBuffer sb = new StringBuffer("(");
-        Class[] params = meth.getParameterTypes(); // avoid clone
+        Class<?>[] params = meth.getParameterTypes(); // avoid clone
         for (int j = 0; j < params.length; j++) {
             sb.append(getType(params[j]).getSignature());
         }

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java Fri Jul 22 04:34:27 2011
@@ -78,7 +78,7 @@ class BCELFactory extends EmptyVisitor {
         _out = out;
     }
 
-    private final Map branch_map = new HashMap(); // Map<Instruction, InstructionHandle>
+    private final Map<Instruction, InstructionHandle> branch_map = new HashMap<Instruction, InstructionHandle>();
 
 
     public void start() {
@@ -250,7 +250,7 @@ class BCELFactory extends EmptyVisitor {
     }
 
     // Memorize BranchInstructions that need an update
-    private final List branches = new ArrayList();
+    private final List<BranchInstruction> branches = new ArrayList<BranchInstruction>();
 
 
     public void visitBranchInstruction( BranchInstruction bi ) {
@@ -305,8 +305,8 @@ class BCELFactory extends EmptyVisitor {
 
 
     private void updateBranchTargets() {
-        for (Iterator i = branches.iterator(); i.hasNext();) {
-            BranchInstruction bi = (BranchInstruction) i.next();
+        for (Iterator<BranchInstruction> i = branches.iterator(); i.hasNext();) {
+            BranchInstruction bi = i.next();
             BranchHandle bh = (BranchHandle) branch_map.get(bi);
             int pos = bh.getPosition();
             String name = bi.getName() + "_" + pos;

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java Fri Jul 22 04:34:27 2011
@@ -56,7 +56,7 @@ public class ClassLoader extends java.la
     public static final String[] DEFAULT_IGNORED_PACKAGES = {
             "java.", "javax.", "sun."
     };
-    private Hashtable classes = new Hashtable(); // Hashtable is synchronized thus thread-safe
+    private Hashtable<String, Class<?>> classes = new Hashtable<String, Class<?>>(); // Hashtable is synchronized thus thread-safe
     private String[] ignored_packages;
     private Repository repository = SyntheticRepository.getInstance();
 
@@ -96,11 +96,11 @@ public class ClassLoader extends java.la
     }
 
 
-    protected Class loadClass( String class_name, boolean resolve ) throws ClassNotFoundException {
-        Class cl = null;
+    protected Class<?> loadClass( String class_name, boolean resolve ) throws ClassNotFoundException {
+        Class<?> cl = null;
         /* First try: lookup hash table.
          */
-        if ((cl = (Class) classes.get(class_name)) == null) {
+        if ((cl = classes.get(class_name)) == null) {
             /* Second try: Load system class using system class loader. You better
              * don't mess around with them.
              */

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java Fri Jul 22 04:34:27 2011
@@ -41,7 +41,7 @@ public class ClassLoaderRepository imple
 
     private static final long serialVersionUID = -1052781833503868187L;
     private java.lang.ClassLoader loader;
-    private Map loadedClasses = new HashMap(); // CLASSNAME X JAVACLASS
+    private Map<String, JavaClass> loadedClasses = new HashMap<String, JavaClass>(); // CLASSNAME X JAVACLASS
 
 
     public ClassLoaderRepository(java.lang.ClassLoader loader) {
@@ -71,7 +71,7 @@ public class ClassLoaderRepository imple
      */
     public JavaClass findClass( String className ) {
         if (loadedClasses.containsKey(className)) {
-            return (JavaClass) loadedClasses.get(className);
+            return loadedClasses.get(className);
         } else {
             return null;
         }
@@ -102,7 +102,7 @@ public class ClassLoaderRepository imple
     }
 
 
-    public JavaClass loadClass( Class clazz ) throws ClassNotFoundException {
+    public JavaClass loadClass( Class<?> clazz ) throws ClassNotFoundException {
         return loadClass(clazz.getName());
     }
 

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassPath.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassPath.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassPath.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassPath.java Fri Jul 22 04:34:27 2011
@@ -63,7 +63,7 @@ public class ClassPath implements Serial
      */
     public ClassPath(String class_path) {
         this.class_path = class_path;
-        List vec = new ArrayList();
+        List<PathEntry> vec = new ArrayList<PathEntry>();
         for (StringTokenizer tok = new StringTokenizer(class_path, System
                 .getProperty("path.separator")); tok.hasMoreTokens();) {
             String path = tok.nextToken();
@@ -122,7 +122,7 @@ public class ClassPath implements Serial
     }
 
 
-    private static final void getPathComponents( String path, List list ) {
+    private static final void getPathComponents( String path, List<String> list ) {
         if (path != null) {
             StringTokenizer tok = new StringTokenizer(path, File.pathSeparator);
             while (tok.hasMoreTokens()) {
@@ -145,13 +145,13 @@ public class ClassPath implements Serial
         String class_path = System.getProperty("java.class.path");
         String boot_path = System.getProperty("sun.boot.class.path");
         String ext_path = System.getProperty("java.ext.dirs");
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         getPathComponents(class_path, list);
         getPathComponents(boot_path, list);
-        List dirs = new ArrayList();
+        List<String> dirs = new ArrayList<String>();
         getPathComponents(ext_path, dirs);
-        for (Iterator e = dirs.iterator(); e.hasNext();) {
-            File ext_dir = new File((String) e.next());
+        for (Iterator<String> e = dirs.iterator(); e.hasNext();) {
+            File ext_dir = new File(e.next());
             String[] extensions = ext_dir.list(new FilenameFilter() {
 
                 public boolean accept( File dir, String name ) {
@@ -166,8 +166,8 @@ public class ClassPath implements Serial
             }
         }
         StringBuffer buf = new StringBuffer();
-        for (Iterator e = list.iterator(); e.hasNext();) {
-            buf.append((String) e.next());
+        for (Iterator<String> e = list.iterator(); e.hasNext();) {
+            buf.append(e.next());
             if (e.hasNext()) {
                 buf.append(File.pathSeparatorChar);
             }
@@ -237,8 +237,8 @@ public class ClassPath implements Serial
      * @return An Enumeration of URLs supplying the resource, or an
      * empty Enumeration if no resource with that name.
      */
-    public Enumeration getResources(String name) {
-        Vector results = new Vector();
+    public Enumeration<URL> getResources(String name) {
+        Vector<URL> results = new Vector<URL>();
         for (int i = 0; i < paths.length; i++) {
             URL url;
             if ((url = paths[i].getResource(name)) != null) {

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassQueue.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassQueue.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassQueue.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassQueue.java Fri Jul 22 04:34:27 2011
@@ -30,7 +30,7 @@ import org.apache.bcel.classfile.JavaCla
 public class ClassQueue implements java.io.Serializable {
 
     private static final long serialVersionUID = 685144104322420292L;
-    protected LinkedList vec = new LinkedList();
+    protected LinkedList<JavaClass> vec = new LinkedList<JavaClass>();
 
 
     public void enqueue( JavaClass clazz ) {
@@ -39,7 +39,7 @@ public class ClassQueue implements java.
 
 
     public JavaClass dequeue() {
-        return (JavaClass) vec.removeFirst();
+        return vec.removeFirst();
     }
 
 

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassSet.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassSet.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassSet.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassSet.java Fri Jul 22 04:34:27 2011
@@ -34,7 +34,7 @@ import org.apache.bcel.classfile.JavaCla
 public class ClassSet implements java.io.Serializable {
 
     private static final long serialVersionUID = -7476907380350035254L;
-    private Map _map = new HashMap();
+    private Map<String, JavaClass> _map = new HashMap<String, JavaClass>();
 
 
     public boolean add( JavaClass clazz ) {
@@ -58,7 +58,7 @@ public class ClassSet implements java.io
 
 
     public JavaClass[] toArray() {
-        Collection values = _map.values();
+        Collection<JavaClass> values = _map.values();
         JavaClass[] classes = new JavaClass[values.size()];
         values.toArray(classes);
         return classes;
@@ -66,6 +66,6 @@ public class ClassSet implements java.io
 
 
     public String[] getClassNames() {
-        return (String[]) _map.keySet().toArray(new String[_map.keySet().size()]);
+        return _map.keySet().toArray(new String[_map.keySet().size()]);
     }
 }

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassStack.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassStack.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassStack.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassStack.java Fri Jul 22 04:34:27 2011
@@ -30,7 +30,7 @@ import org.apache.bcel.classfile.JavaCla
 public class ClassStack implements java.io.Serializable {
 
     private static final long serialVersionUID = 6126079269396985982L;
-    private Stack stack = new Stack();
+    private Stack<JavaClass> stack = new Stack<JavaClass>();
 
 
     public void push( JavaClass clazz ) {
@@ -39,12 +39,12 @@ public class ClassStack implements java.
 
 
     public JavaClass pop() {
-        return (JavaClass) stack.pop();
+        return stack.pop();
     }
 
 
     public JavaClass top() {
-        return (JavaClass) stack.peek();
+        return stack.peek();
     }
 
 

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassVector.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassVector.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassVector.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassVector.java Fri Jul 22 04:34:27 2011
@@ -33,7 +33,7 @@ import org.apache.bcel.classfile.JavaCla
 public class ClassVector implements java.io.Serializable {
 
     private static final long serialVersionUID = 5600397075672780806L;
-    protected List vec = new ArrayList();
+    protected List<JavaClass> vec = new ArrayList<JavaClass>();
 
 
     public void addElement( JavaClass clazz ) {
@@ -42,7 +42,7 @@ public class ClassVector implements java
 
 
     public JavaClass elementAt( int index ) {
-        return (JavaClass) vec.get(index);
+        return vec.get(index);
     }
 
 

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/InstructionFinder.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/InstructionFinder.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/InstructionFinder.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/InstructionFinder.java Fri Jul 22 04:34:27 2011
@@ -73,7 +73,7 @@ public class InstructionFinder {
     // LATIN-1
     private static final int NO_OPCODES = 256; // Potential number,
     // some are not used
-    private static final Map map = new HashMap(); // Map<String,Pattern>
+    private static final Map<String, String> map = new HashMap<String, String>();
     private InstructionList il;
     private String il_string; // instruction list
     // as string
@@ -116,7 +116,7 @@ public class InstructionFinder {
      * @return encoded string for a pattern such as "BranchInstruction".
      */
     private static final String mapName( String pattern ) {
-        String result = (String) map.get(pattern);
+        String result = map.get(pattern);
         if (result != null) {
             return result;
         }
@@ -210,7 +210,7 @@ public class InstructionFinder {
      * @return iterator of matches where e.nextElement() returns an array of
      *         instruction handles describing the matched area
      */
-    public final Iterator search( String pattern, InstructionHandle from, CodeConstraint constraint ) {
+    public final Iterator<InstructionHandle[]> search( String pattern, InstructionHandle from, CodeConstraint constraint ) {
         String search = compilePattern(pattern);
         int start = -1;
         for (int i = 0; i < handles.length; i++) {
@@ -224,7 +224,7 @@ public class InstructionFinder {
                     + " not found in instruction list.");
         }
         Pattern regex = Pattern.compile(search);
-        List matches = new ArrayList();
+        List<InstructionHandle[]> matches = new ArrayList<InstructionHandle[]>();
         Matcher matcher = regex.matcher(il_string);
         while (start < il_string.length() && matcher.find(start)) {
             int startExpr = matcher.start();
@@ -248,7 +248,7 @@ public class InstructionFinder {
      * @return iterator of matches where e.nextElement() returns an array of
      *         instruction handles describing the matched area
      */
-    public final Iterator search( String pattern ) {
+    public final Iterator<InstructionHandle[]> search( String pattern ) {
         return search(pattern, il.getStart(), null);
     }
 
@@ -263,7 +263,7 @@ public class InstructionFinder {
      * @return iterator of matches where e.nextElement() returns an array of
      *         instruction handles describing the matched area
      */
-    public final Iterator search( String pattern, InstructionHandle from ) {
+    public final Iterator<InstructionHandle[]> search( String pattern, InstructionHandle from ) {
         return search(pattern, from, null);
     }
 
@@ -278,7 +278,7 @@ public class InstructionFinder {
      *          constraints to be checked on matching code
      * @return instruction handle or `null' if the match failed
      */
-    public final Iterator search( String pattern, CodeConstraint constraint ) {
+    public final Iterator<InstructionHandle[]> search( String pattern, CodeConstraint constraint ) {
         return search(pattern, il.getStart(), constraint);
     }
 
@@ -363,9 +363,9 @@ public class InstructionFinder {
 		map.put("fstore", precompile(Constants.FSTORE_0, Constants.FSTORE_3, Constants.FSTORE));
 		map.put("astore", precompile(Constants.ASTORE_0, Constants.ASTORE_3, Constants.ASTORE));
 		// Compile strings
-		for (Iterator i = map.keySet().iterator(); i.hasNext();) {
-			String key = (String) i.next();
-			String value = (String) map.get(key);
+		for (Iterator<String> i = map.keySet().iterator(); i.hasNext();) {
+			String key = i.next();
+			String value = map.get(key);
 			char ch = value.charAt(1); // Omit already precompiled patterns
 			if (ch < OFFSET) {
 				map.put(key, compilePattern(value)); // precompile all

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/JavaWrapper.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/JavaWrapper.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/JavaWrapper.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/JavaWrapper.java Fri Jul 22 04:34:27 2011
@@ -70,7 +70,7 @@ public class JavaWrapper {
      * @param argv the arguments just as you would pass them directly
      */
     public void runMain( String class_name, String[] argv ) throws ClassNotFoundException {
-        Class cl = loader.loadClass(class_name);
+        Class<?> cl = loader.loadClass(class_name);
         Method method = null;
         try {
             method = cl.getMethod("main", new Class[] {
@@ -79,7 +79,7 @@ public class JavaWrapper {
             /* Method main is sane ?
              */
             int m = method.getModifiers();
-            Class r = method.getReturnType();
+            Class<?> r = method.getReturnType();
             if (!(Modifier.isPublic(m) && Modifier.isStatic(m)) || Modifier.isAbstract(m)
                     || (r != Void.TYPE)) {
                 throw new NoSuchMethodException();

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/Repository.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/Repository.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/Repository.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/Repository.java Fri Jul 22 04:34:27 2011
@@ -60,7 +60,7 @@ public interface Repository extends java
     /**
      * Find the JavaClass instance for the given run-time class object
      */
-    public JavaClass loadClass( Class clazz ) throws java.lang.ClassNotFoundException;
+    public JavaClass loadClass( Class<?> clazz ) throws java.lang.ClassNotFoundException;
 
 
     /** Clear all entries from cache.

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java Fri Jul 22 04:34:27 2011
@@ -45,9 +45,9 @@ public class SyntheticRepository impleme
 
     private static final long serialVersionUID = 2923440730410019444L;
     //private static final String DEFAULT_PATH = ClassPath.getClassPath();
-    private static final Map _instances = new HashMap(); // CLASSPATH X REPOSITORY
+    private static final Map<ClassPath, SyntheticRepository> _instances = new HashMap<ClassPath, SyntheticRepository>(); // CLASSPATH X REPOSITORY
     private ClassPath _path = null;
-    private Map _loadedClasses = new HashMap(); // CLASSNAME X JAVACLASS
+    private Map<String, SoftReference<JavaClass>> _loadedClasses = new HashMap<String, SoftReference<JavaClass>>(); // CLASSNAME X JAVACLASS
 
 
     private SyntheticRepository(ClassPath path) {
@@ -61,7 +61,7 @@ public class SyntheticRepository impleme
 
 
     public static SyntheticRepository getInstance( ClassPath classPath ) {
-        SyntheticRepository rep = (SyntheticRepository) _instances.get(classPath);
+        SyntheticRepository rep = _instances.get(classPath);
         if (rep == null) {
             rep = new SyntheticRepository(classPath);
             _instances.put(classPath, rep);
@@ -74,7 +74,7 @@ public class SyntheticRepository impleme
      * Store a new JavaClass instance into this Repository.
      */
     public void storeClass( JavaClass clazz ) {
-        _loadedClasses.put(clazz.getClassName(), new SoftReference(clazz));
+        _loadedClasses.put(clazz.getClassName(), new SoftReference<JavaClass>(clazz));
         clazz.setRepository(this);
     }
 
@@ -91,11 +91,11 @@ public class SyntheticRepository impleme
      * Find an already defined (cached) JavaClass object by name.
      */
     public JavaClass findClass( String className ) {
-        SoftReference ref = (SoftReference) _loadedClasses.get(className);
+        SoftReference<JavaClass> ref = _loadedClasses.get(className);
         if (ref == null) {
             return null;
         }
-        return (JavaClass) ref.get();
+        return ref.get();
     }
 
 
@@ -141,7 +141,7 @@ public class SyntheticRepository impleme
      * @throws ClassNotFoundException if the class is not in the
      *   Repository, and its representation could not be found
      */
-    public JavaClass loadClass( Class clazz ) throws ClassNotFoundException {
+    public JavaClass loadClass( Class<?> clazz ) throws ClassNotFoundException {
     	InputStream clsStream = null;
     	try{
 	        String className = clazz.getName();

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/PassVerifier.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/PassVerifier.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/PassVerifier.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/PassVerifier.java Fri Jul 22 04:34:27 2011
@@ -49,7 +49,7 @@ import java.util.List;
 public abstract class PassVerifier {
 
     /** The (warning) messages. */
-    private List messages = new ArrayList(); //Type of elements: String
+    private List<String> messages = new ArrayList<String>();
     /** The VerificationResult cache. */
     private VerificationResult verificationResult = null;
 
@@ -101,6 +101,6 @@ public abstract class PassVerifier {
      */
     public String[] getMessages() {
         verify(); // create messages if not already done (cached!)
-        return (String[]) messages.toArray(new String[messages.size()]);
+        return messages.toArray(new String[messages.size()]);
     }
 }

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/Verifier.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/Verifier.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/Verifier.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/Verifier.java Fri Jul 22 04:34:27 2011
@@ -20,7 +20,9 @@ package org.apache.bcel.verifier;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
+
 import org.apache.bcel.classfile.JavaClass;
 import org.apache.bcel.verifier.statics.Pass1Verifier;
 import org.apache.bcel.verifier.statics.Pass2Verifier;
@@ -54,9 +56,9 @@ public class Verifier {
     /** A Pass2Verifier for this Verifier instance. */
     private Pass2Verifier p2v;
     /** The Pass3aVerifiers for this Verifier instance. Key: Interned string specifying the method number. */
-    private Map p3avs = new HashMap();
+    private Map<String, Pass3aVerifier> p3avs = new HashMap<String, Pass3aVerifier>();
     /** The Pass3bVerifiers for this Verifier instance. Key: Interned string specifying the method number. */
-    private Map p3bvs = new HashMap();
+    private Map<String, Pass3bVerifier> p3bvs = new HashMap<String, Pass3bVerifier>();
 
 
     /** Returns the VerificationResult for the given pass. */
@@ -81,7 +83,7 @@ public class Verifier {
     public VerificationResult doPass3a( int method_no ) {
         String key = Integer.toString(method_no);
         Pass3aVerifier p3av;
-        p3av = (Pass3aVerifier) (p3avs.get(key));
+        p3av = p3avs.get(key);
         if (p3avs.get(key) == null) {
             p3av = new Pass3aVerifier(this, method_no);
             p3avs.put(key, p3av);
@@ -94,7 +96,7 @@ public class Verifier {
     public VerificationResult doPass3b( int method_no ) {
         String key = Integer.toString(method_no);
         Pass3bVerifier p3bv;
-        p3bv = (Pass3bVerifier) (p3bvs.get(key));
+        p3bv = p3bvs.get(key);
         if (p3bvs.get(key) == null) {
             p3bv = new Pass3bVerifier(this, method_no);
             p3bvs.put(key, p3bv);
@@ -145,7 +147,7 @@ public class Verifier {
      * A prefix shows from which verifying pass a message originates.
      */
     public String[] getMessages() throws ClassNotFoundException {
-        ArrayList messages = new ArrayList();
+        List<String> messages = new ArrayList<String>();
         if (p1v != null) {
             String[] p1m = p1v.getMessages();
             for (int i = 0; i < p1m.length; i++) {
@@ -158,9 +160,9 @@ public class Verifier {
                 messages.add("Pass 2: " + p2m[i]);
             }
         }
-        Iterator p3as = p3avs.values().iterator();
+        Iterator<Pass3aVerifier> p3as = p3avs.values().iterator();
         while (p3as.hasNext()) {
-            Pass3aVerifier pv = (Pass3aVerifier) p3as.next();
+            Pass3aVerifier pv = p3as.next();
             String[] p3am = pv.getMessages();
             int meth = pv.getMethodNo();
             for (int i = 0; i < p3am.length; i++) {
@@ -169,9 +171,9 @@ public class Verifier {
                         + "'): " + p3am[i]);
             }
         }
-        Iterator p3bs = p3bvs.values().iterator();
+        Iterator<Pass3bVerifier> p3bs = p3bvs.values().iterator();
         while (p3bs.hasNext()) {
-            Pass3bVerifier pv = (Pass3bVerifier) p3bs.next();
+            Pass3bVerifier pv = p3bs.next();
             String[] p3bm = pv.getMessages();
             int meth = pv.getMethodNo();
             for (int i = 0; i < p3bm.length; i++) {
@@ -182,7 +184,7 @@ public class Verifier {
         }
         String[] ret = new String[messages.size()];
         for (int i = 0; i < messages.size(); i++) {
-            ret[i] = (String) messages.get(i);
+            ret[i] = messages.get(i);
         }
         return ret;
     }

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifierFactory.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifierFactory.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifierFactory.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifierFactory.java Fri Jul 22 04:34:27 2011
@@ -38,11 +38,11 @@ public class VerifierFactory {
     /**
      * The HashMap that holds the data about the already-constructed Verifier instances.
      */
-    private static final Map hashMap = new HashMap();
+    private static final Map<String, Verifier> hashMap = new HashMap<String, Verifier>();
     /**
      * The VerifierFactoryObserver instances that observe the VerifierFactory.
      */
-    private static final List observers = new Vector();
+    private static final List<VerifierFactoryObserver> observers = new Vector<VerifierFactoryObserver>();
 
 
     /**
@@ -58,7 +58,7 @@ public class VerifierFactory {
      * @return the (only) verifier responsible for the class with the given name.
      */
     public static Verifier getVerifier( String fully_qualified_classname ) {
-        Verifier v = (Verifier) (hashMap.get(fully_qualified_classname));
+        Verifier v = hashMap.get(fully_qualified_classname);
         if (v == null) {
             v = new Verifier(fully_qualified_classname);
             hashMap.put(fully_qualified_classname, v);
@@ -73,9 +73,9 @@ public class VerifierFactory {
      */
     private static void notify( String fully_qualified_classname ) {
         // notify the observers
-        Iterator i = observers.iterator();
+        Iterator<VerifierFactoryObserver> i = observers.iterator();
         while (i.hasNext()) {
-            VerifierFactoryObserver vfo = (VerifierFactoryObserver) i.next();
+            VerifierFactoryObserver vfo = i.next();
             vfo.update(fully_qualified_classname);
         }
     }
@@ -90,7 +90,7 @@ public class VerifierFactory {
      */
     public static Verifier[] getVerifiers() {
         Verifier[] vs = new Verifier[hashMap.values().size()];
-        return (Verifier[]) (hashMap.values().toArray(vs)); // Because vs is big enough, vs is used to store the values into and returned!
+        return hashMap.values().toArray(vs); // Because vs is big enough, vs is used to store the values into and returned!
     }
 
 

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifierFactoryListModel.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifierFactoryListModel.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifierFactoryListModel.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/VerifierFactoryListModel.java Fri Jul 22 04:34:27 2011
@@ -17,7 +17,13 @@
  */
 package org.apache.bcel.verifier;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
 import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
 
 /**
  * This class implements an adapter; it implements both a Swing ListModel and
@@ -29,8 +35,8 @@ import javax.swing.event.ListDataEvent;
 public class VerifierFactoryListModel implements org.apache.bcel.verifier.VerifierFactoryObserver,
         javax.swing.ListModel {
 
-    private java.util.ArrayList listeners = new java.util.ArrayList();
-    private java.util.TreeSet cache = new java.util.TreeSet();
+    private List<ListDataListener> listeners = new ArrayList<ListDataListener>();
+    private Set<String> cache = new TreeSet<String>();
 
 
     public VerifierFactoryListModel() {
@@ -50,12 +56,12 @@ public class VerifierFactoryListModel im
         for (int i = 0; i < size; i++) {
             ListDataEvent e = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0,
                     num_of_verifiers - 1);
-            ((javax.swing.event.ListDataListener) (listeners.get(i))).contentsChanged(e);
+            listeners.get(i).contentsChanged(e);
         }
     }
 
 
-    public synchronized void addListDataListener( javax.swing.event.ListDataListener l ) {
+    public synchronized void addListDataListener( ListDataListener l ) {
         listeners.add(l);
     }
 

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/IntList.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/IntList.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/IntList.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/IntList.java Fri Jul 22 04:34:27 2011
@@ -29,14 +29,14 @@ import java.util.List;
  */
 public class IntList{
 	/** The int are stored as Integer objects here. */
-	private List theList;
+	private List<Integer> theList;
 	/** This constructor creates an empty list. */
 	IntList(){
-		theList = new ArrayList();
+		theList = new ArrayList<Integer>();
 	}
 	/** Adds an element to the list. */
 	void add(int i){
-		theList.add(new Integer(i));
+		theList.add(Integer.valueOf(i));
 	}
 	/** Checks if the specified int is already in the list. */
 	boolean contains(int i){

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/LocalVariableInfo.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/LocalVariableInfo.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/LocalVariableInfo.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/LocalVariableInfo.java Fri Jul 22 04:34:27 2011
@@ -34,9 +34,9 @@ import org.apache.bcel.verifier.exc.Loca
 public class LocalVariableInfo{
 
 	/** The types database. KEY: String representing the offset integer. */
-	private Hashtable types = new Hashtable();
+	private Hashtable<String, Type> types = new Hashtable<String, Type>();
 	/** The names database. KEY: String representing the offset integer. */
-	private Hashtable names = new Hashtable();
+	private Hashtable<String, String> names = new Hashtable<String, String>();
 
 	/**
 	 * Adds a name of a local variable and a certain slot to our 'names'
@@ -62,7 +62,7 @@ public class LocalVariableInfo{
 	 * variable slot at the given bytecode offset.
 	 */
 	public Type getType(int offset){
-		return (Type) types.get(Integer.toString(offset));
+		return types.get(Integer.toString(offset));
 	}
 	/**
 	 * Returns the name of the local variable that uses this local
@@ -73,7 +73,7 @@ public class LocalVariableInfo{
 	 * variable slot at the given bytecode offset.
 	 */
 	public String getName(int offset){
-		return (String) (names.get(Integer.toString(offset)));
+		return (names.get(Integer.toString(offset)));
 	}
 	/**
 	 * Adds some information about this local variable (slot).

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java Fri Jul 22 04:34:27 2011
@@ -190,7 +190,7 @@ public final class Pass2Verifier extends
 	 */
 	private void every_class_has_an_accessible_superclass(){
 	    try {
-		Set hs = new HashSet(); // save class names to detect circular inheritance
+		Set<String> hs = new HashSet<String>(); // save class names to detect circular inheritance
 		JavaClass jc = Repository.lookupClass(myOwner.getClassName());
 		int supidx = -1;
 
@@ -240,7 +240,7 @@ public final class Pass2Verifier extends
 	 */
 	private void final_methods_are_not_overridden(){
 	    try {
-		Map hashmap = new HashMap();
+		Map<String, String> hashmap = new HashMap<String, String>();
 		JavaClass jc = Repository.lookupClass(myOwner.getClassName());
 		
 		int supidx = -1;
@@ -311,28 +311,28 @@ public final class Pass2Verifier extends
    * @see #constant_pool_entries_satisfy_static_constraints()
 	 */
 	private class CPESSC_Visitor extends org.apache.bcel.classfile.EmptyVisitor{
-		private Class CONST_Class;
+		private Class<?> CONST_Class;
 		/*
-        private Class CONST_Fieldref;
-		private Class CONST_Methodref;
-		private Class CONST_InterfaceMethodref;
+        private Class<?> CONST_Fieldref;
+		private Class<?> CONST_Methodref;
+		private Class<?> CONST_InterfaceMethodref;
         */
-		private Class CONST_String;
-		private Class CONST_Integer;
-		private Class CONST_Float;
-		private Class CONST_Long;
-		private Class CONST_Double;
-		private Class CONST_NameAndType;
-		private Class CONST_Utf8;
+		private Class<?> CONST_String;
+		private Class<?> CONST_Integer;
+		private Class<?> CONST_Float;
+		private Class<?> CONST_Long;
+		private Class<?> CONST_Double;
+		private Class<?> CONST_NameAndType;
+		private Class<?> CONST_Utf8;
 
 		private final JavaClass jc;
 		private final ConstantPool cp; // ==jc.getConstantPool() -- only here to save typing work and computing power.
 		private final int cplen; // == cp.getLength() -- to save computing power.
 		private DescendingVisitor carrier;
 
-		private Set field_names = new HashSet();
-		private Set field_names_and_desc = new HashSet();
-		private Set method_names_and_desc = new HashSet();
+		private Set<String> field_names = new HashSet<String>();
+		private Set<String> field_names_and_desc = new HashSet<String>();
+		private Set<String> method_names_and_desc = new HashSet<String>();
 
 		private CPESSC_Visitor(JavaClass _jc){
 			jc = _jc;
@@ -357,7 +357,7 @@ public final class Pass2Verifier extends
 			carrier.visit();
 		}
 
-		private void checkIndex(Node referrer, int index, Class shouldbe){
+		private void checkIndex(Node referrer, int index, Class<?> shouldbe){
 			if ((index < 0) || (index >= cplen)){
 				throw new ClassConstraintException("Invalid index '"+index+"' used by '"+tostring(referrer)+"'.");
 			}

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/ControlFlowGraph.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/ControlFlowGraph.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/ControlFlowGraph.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/ControlFlowGraph.java Fri Jul 22 04:34:27 2011
@@ -20,6 +20,7 @@ package org.apache.bcel.verifier.structu
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.bcel.generic.ATHROW;
@@ -66,18 +67,18 @@ public class ControlFlowGraph{
 		/**
 		 * The 'incoming' execution Frames.
 		 */
-		private Map inFrames;	// key: the last-executed JSR
+		private Map<InstructionContext, Frame> inFrames;	// key: the last-executed JSR
 
 		/**
 		 * The 'outgoing' execution Frames.
 		 */
-		private Map outFrames; // key: the last-executed JSR 
+		private Map<InstructionContext, Frame> outFrames; // key: the last-executed JSR 
 
 		/**
 		 * The 'execution predecessors' - a list of type InstructionContext 
 		 * of those instances that have been execute()d before in that order.
 		 */
-		private ArrayList executionPredecessors = null; // Type: InstructionContext
+		private List<InstructionContext> executionPredecessors = null; // Type: InstructionContext
 	
 		/**
 		 * Creates an InstructionHandleImpl object from an InstructionHandle.
@@ -89,8 +90,8 @@ public class ControlFlowGraph{
             }
 		
 			instruction = inst;
-			inFrames = new java.util.HashMap();
-			outFrames = new java.util.HashMap();
+			inFrames = new HashMap<InstructionContext, Frame>();
+			outFrames = new HashMap<InstructionContext, Frame>();
 		}
 
 		/* Satisfies InstructionContext.getTag(). */
@@ -113,14 +114,14 @@ public class ControlFlowGraph{
 		/**
 		 * Returns a clone of the "outgoing" frame situation with respect to the given ExecutionChain.
 		 */	
-		public Frame getOutFrame(ArrayList execChain){
+		public Frame getOutFrame(List<InstructionContext> execChain){
 			executionPredecessors = execChain;
 
 			Frame org;
 
 			InstructionContext jsr = lastExecutionJSR();
 
-			org = (Frame) outFrames.get(jsr);
+			org = outFrames.get(jsr);
 
 			if (org == null){
 				throw new AssertionViolatedException("outFrame not set! This:\n"+this+"\nExecutionChain: "+getExecutionChain()+"\nOutFrames: '"+outFrames+"'.");
@@ -133,7 +134,7 @@ public class ControlFlowGraph{
 			
 			InstructionContext jsr = lastExecutionJSR();
 			
-			org = (Frame) inFrames.get(jsr);
+			org = inFrames.get(jsr);
 
 			if (org == null){
 			    throw new AssertionViolatedException("inFrame not set! This:\n"+this+"\nInFrames: '"+inFrames+"'.");
@@ -156,9 +157,9 @@ public class ControlFlowGraph{
 		 * @return true - if and only if the "outgoing" frame situation
 		 * changed from the one before execute()ing.
 		 */
-		public boolean execute(Frame inFrame, ArrayList execPreds, InstConstraintVisitor icv, ExecutionVisitor ev){
+		public boolean execute(Frame inFrame, ArrayList<InstructionContext> execPreds, InstConstraintVisitor icv, ExecutionVisitor ev){
 
-			executionPredecessors = (ArrayList) execPreds.clone();
+			executionPredecessors = (List<InstructionContext>) execPreds.clone();
 
 			//sanity check
 			if ( (lastExecutionJSR() == null) && (subroutines.subroutineOf(getInstruction()) != subroutines.getTopLevel() ) ){
@@ -168,7 +169,7 @@ public class ControlFlowGraph{
 				throw new AssertionViolatedException("Huh?! Am I '"+this+"' part of a subroutine or not?");
 			}
 
-			Frame inF = (Frame) inFrames.get(lastExecutionJSR());
+			Frame inF = inFrames.get(lastExecutionJSR());
 			if (inF == null){// no incoming frame was set, so set it.
 				inFrames.put(lastExecutionJSR(), inFrame);
 				inF = inFrame;
@@ -230,7 +231,7 @@ public class ControlFlowGraph{
 		 */
 		private boolean mergeInFrames(Frame inFrame){
 			// TODO: Can be performance-improved.
-			Frame inF = (Frame) inFrames.get(lastExecutionJSR());
+			Frame inF = inFrames.get(lastExecutionJSR());
 			OperandStack oldstack = inF.getStack().getClone();
 			LocalVariables oldlocals = inF.getLocals().getClone();
 			try{
@@ -402,7 +403,7 @@ public class ControlFlowGraph{
 	private final ExceptionHandlers exceptionhandlers;
 
 	/** All InstructionContext instances of this ControlFlowGraph. */
-	private Map instructionContexts = new HashMap(); //keys: InstructionHandle, values: InstructionContextImpl
+	private Map<InstructionHandle, InstructionContext> instructionContexts = new HashMap<InstructionHandle, InstructionContext>(); //keys: InstructionHandle, values: InstructionContextImpl
 
 	/** 
 	 * A Control Flow Graph.
@@ -423,7 +424,7 @@ public class ControlFlowGraph{
 	 * Returns the InstructionContext of a given instruction.
 	 */
 	public InstructionContext contextOf(InstructionHandle inst){
-		InstructionContext ic = (InstructionContext) instructionContexts.get(inst);
+		InstructionContext ic = instructionContexts.get(inst);
 		if (ic == null){
 			throw new AssertionViolatedException("InstructionContext requested for an InstructionHandle that's not known!");
 		}
@@ -449,7 +450,7 @@ public class ControlFlowGraph{
 	 */
 	public InstructionContext[] getInstructionContexts(){
 		InstructionContext[] ret = new InstructionContext[instructionContexts.values().size()];
-		return (InstructionContext[]) instructionContexts.values().toArray(ret);
+		return instructionContexts.values().toArray(ret);
 	}
 
 	/**

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/ExceptionHandlers.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/ExceptionHandlers.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/ExceptionHandlers.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/ExceptionHandlers.java Fri Jul 22 04:34:27 2011
@@ -38,21 +38,21 @@ public class ExceptionHandlers{
 	 * The ExceptionHandler instances.
 	 * Key: InstructionHandle objects, Values: HashSet<ExceptionHandler> instances.
 	 */
-	private Map exceptionhandlers;
+	private Map<InstructionHandle, Set<ExceptionHandler>> exceptionhandlers;
 	 
 	/**
 	 * Constructor. Creates a new ExceptionHandlers instance.
 	 */
 	public ExceptionHandlers(MethodGen mg){
-		exceptionhandlers = new HashMap();
+		exceptionhandlers = new HashMap<InstructionHandle, Set<ExceptionHandler>>();
 		CodeExceptionGen[] cegs = mg.getExceptionHandlers();
 		for (int i=0; i<cegs.length; i++){
 			ExceptionHandler eh = new ExceptionHandler(cegs[i].getCatchType(), cegs[i].getHandlerPC());
 			for (InstructionHandle ih=cegs[i].getStartPC(); ih != cegs[i].getEndPC().getNext(); ih=ih.getNext()){
-				Set hs;
-				hs = (Set) exceptionhandlers.get(ih);
+				Set<ExceptionHandler> hs;
+				hs = exceptionhandlers.get(ih);
 				if (hs == null){
-					hs = new HashSet();
+					hs = new HashSet<ExceptionHandler>();
 					exceptionhandlers.put(ih, hs);
 				}
 				hs.add(eh);
@@ -65,12 +65,12 @@ public class ExceptionHandlers{
 	 * handlers that protect the instruction ih.
 	 */
 	public ExceptionHandler[] getExceptionHandlers(InstructionHandle ih){
-		Set hs = (Set) exceptionhandlers.get(ih);
+		Set<ExceptionHandler> hs = exceptionhandlers.get(ih);
 		if (hs == null) {
             return new ExceptionHandler[0];
         } else{
 			ExceptionHandler[] ret = new ExceptionHandler[hs.size()];
-			return (ExceptionHandler[]) (hs.toArray(ret));
+			return hs.toArray(ret);
 		}
 	}
 

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/InstructionContext.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/InstructionContext.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/InstructionContext.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/InstructionContext.java Fri Jul 22 04:34:27 2011
@@ -19,6 +19,8 @@ package org.apache.bcel.verifier.structu
 
 
 import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.bcel.generic.InstructionHandle;
 
 /**
@@ -72,7 +74,7 @@ public interface InstructionContext{
 	 * @return true -  if and only if the "outgoing" frame situation
 	 * changed from the one before execute()ing.
 	 */
-	boolean execute(Frame inFrame, ArrayList executionPredecessors, InstConstraintVisitor icv, ExecutionVisitor ev);
+	boolean execute(Frame inFrame, ArrayList<InstructionContext> executionPredecessors, InstConstraintVisitor icv, ExecutionVisitor ev);
 
 	Frame getInFrame();
 
@@ -83,7 +85,7 @@ public interface InstructionContext{
 	 *
 	 * @see #execute(Frame, ArrayList, InstConstraintVisitor, ExecutionVisitor)
 	 */
-	Frame getOutFrame(ArrayList executionPredecessors);
+	Frame getOutFrame(List<InstructionContext> executionPredecessors);
 	
 	/**
 	 * Returns the InstructionHandle this InstructionContext is wrapped around.

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java Fri Jul 22 04:34:27 2011
@@ -36,7 +36,7 @@ import org.apache.bcel.verifier.exc.Stru
 public class OperandStack{
 
 	/** We hold the stack information here. */
-	private ArrayList stack = new ArrayList();
+	private ArrayList<Type> stack = new ArrayList<Type>();
 
 	/** The maximum number of stack slots this OperandStack instance may hold. */
 	private int maxStack;
@@ -63,7 +63,7 @@ public class OperandStack{
 	 */
 	protected Object clone(){
 		OperandStack newstack = new OperandStack(this.maxStack);
-		newstack.stack = (ArrayList) this.stack.clone();
+		newstack.stack = (ArrayList<Type>) this.stack.clone();
 		return newstack;
 	}
 
@@ -71,7 +71,7 @@ public class OperandStack{
 	 * Clears the stack.
 	 */
 	public void clear(){
-		stack = new ArrayList();
+		stack = new ArrayList<Type>();
 	}
 
 	/** @return a hash code value for the object.
@@ -126,14 +126,14 @@ public class OperandStack{
    * iff i==0 the top element is returned. The element is not popped off the stack!
    */
 	public Type peek(int i){
-		return (Type) stack.get(size()-i-1);
+		return stack.get(size()-i-1);
 	}
 
 	/**
 	 * Returns the element on top of the stack. The element is popped off the stack.
 	 */
 	public Type pop(){
-		Type e = (Type) stack.remove(size()-1);
+		Type e = stack.remove(size()-1);
 		return e;
 	}
 

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java Fri Jul 22 04:34:27 2011
@@ -79,9 +79,9 @@ public final class Pass3bVerifier extend
 	 * we have about its symbolic execution predecessors.
 	 */
 	private static final class InstructionContextQueue{
-		private List ics = new Vector(); // Type: InstructionContext
-		private List ecs = new Vector(); // Type: ArrayList (of InstructionContext)
-		public void add(InstructionContext ic, ArrayList executionChain){
+		private List<InstructionContext> ics = new Vector<InstructionContext>();
+		private List<ArrayList<InstructionContext>> ecs = new Vector<ArrayList<InstructionContext>>();
+		public void add(InstructionContext ic, ArrayList<InstructionContext> executionChain){
 			ics.add(ic);
 			ecs.add(executionChain);
 		}
@@ -93,10 +93,10 @@ public final class Pass3bVerifier extend
 			ecs.remove(i);
 		}
 		public InstructionContext getIC(int i){
-			return (InstructionContext) ics.get(i);
+			return ics.get(i);
 		}
-		public ArrayList getEC(int i){
-			return (ArrayList) ecs.get(i);
+		public ArrayList<InstructionContext> getEC(int i){
+			return ecs.get(i);
 		}
 		public int size(){
 			return ics.size();
@@ -133,14 +133,14 @@ public final class Pass3bVerifier extend
 		final Random random = new Random();
 		InstructionContextQueue icq = new InstructionContextQueue();
 		
-		start.execute(vanillaFrame, new ArrayList(), icv, ev);	// new ArrayList() <=>	no Instruction was executed before
+		start.execute(vanillaFrame, new ArrayList<InstructionContext>(), icv, ev);	// new ArrayList() <=>	no Instruction was executed before
 																									//									=> Top-Level routine (no jsr call before)
-		icq.add(start, new ArrayList());
+		icq.add(start, new ArrayList<InstructionContext>());
 
 		// LOOP!
 		while (!icq.isEmpty()){
 			InstructionContext u;
-			ArrayList ec;
+			ArrayList<InstructionContext> ec;
 			if (!DEBUG){
 				int r = random.nextInt(icq.size());
 				u = icq.getIC(r);
@@ -153,8 +153,8 @@ public final class Pass3bVerifier extend
 				icq.remove(0);
 			}
 			
-			ArrayList oldchain = (ArrayList) (ec.clone());
-			ArrayList newchain = (ArrayList) (ec.clone());
+			ArrayList<InstructionContext> oldchain = (ArrayList<InstructionContext>) (ec.clone());
+			ArrayList<InstructionContext> newchain = (ArrayList<InstructionContext>) (ec.clone());
 			newchain.add(u);
 
 			if ((u.getInstruction().getInstruction()) instanceof RET){
@@ -173,16 +173,16 @@ public final class Pass3bVerifier extend
 						throw new AssertionViolatedException("More RET than JSR in execution chain?!");
 					}
 //System.err.println("+"+oldchain.get(ss));
-					if (((InstructionContext) oldchain.get(ss)).getInstruction().getInstruction() instanceof JsrInstruction){
+					if ((oldchain.get(ss)).getInstruction().getInstruction() instanceof JsrInstruction){
 						if (skip_jsr == 0){
-							lastJSR = (InstructionContext) oldchain.get(ss);
+							lastJSR = oldchain.get(ss);
 							break;
 						}
 						else{
 							skip_jsr--;
 						}
 					}
-					if (((InstructionContext) oldchain.get(ss)).getInstruction().getInstruction() instanceof RET){
+					if ((oldchain.get(ss)).getInstruction().getInstruction() instanceof RET){
 						skip_jsr++;
 					}
 				}
@@ -195,7 +195,7 @@ public final class Pass3bVerifier extend
 				}
 				
 				if (theSuccessor.execute(u.getOutFrame(oldchain), newchain, icv, ev)){
-					icq.add(theSuccessor, (ArrayList) newchain.clone());
+					icq.add(theSuccessor, (ArrayList<InstructionContext>) newchain.clone());
 				}
 			}
 			else{// "not a ret"
@@ -205,7 +205,7 @@ public final class Pass3bVerifier extend
 				for (int s=0; s<succs.length; s++){
 					InstructionContext v = succs[s];
 					if (v.execute(u.getOutFrame(oldchain), newchain, icv, ev)){
-						icq.add(v, (ArrayList) newchain.clone());
+						icq.add(v, (ArrayList<InstructionContext>) newchain.clone());
 					}
 				}
 			}// end "not a ret"
@@ -225,8 +225,8 @@ public final class Pass3bVerifier extend
 				// by using an empty chain for the exception handlers.
 				//if (v.execute(new Frame(u.getOutFrame(oldchain).getLocals(), new OperandStack (u.getOutFrame().getStack().maxStack(), (exc_hds[s].getExceptionType()==null? Type.THROWABLE : exc_hds[s].getExceptionType())) ), newchain), icv, ev){
 					//icq.add(v, (ArrayList) newchain.clone());
-				if (v.execute(new Frame(u.getOutFrame(oldchain).getLocals(), new OperandStack (u.getOutFrame(oldchain).getStack().maxStack(), (exc_hds[s].getExceptionType()==null? Type.THROWABLE : exc_hds[s].getExceptionType())) ), new ArrayList(), icv, ev)){
-					icq.add(v, new ArrayList());
+				if (v.execute(new Frame(u.getOutFrame(oldchain).getLocals(), new OperandStack (u.getOutFrame(oldchain).getStack().maxStack(), (exc_hds[s].getExceptionType()==null? Type.THROWABLE : exc_hds[s].getExceptionType())) ), new ArrayList<InstructionContext>(), icv, ev)){
+					icq.add(v, new ArrayList<InstructionContext>());
 				}
 			}
 
@@ -236,7 +236,7 @@ public final class Pass3bVerifier extend
 		do{
 			if ((ih.getInstruction() instanceof ReturnInstruction) && (!(cfg.isDead(ih)))) {
 				InstructionContext ic = cfg.contextOf(ih);
-				Frame f = ic.getOutFrame(new ArrayList()); // TODO: This is buggy, we check only the top-level return instructions this way. Maybe some maniac returns from a method when in a subroutine?
+				Frame f = ic.getOutFrame(new ArrayList<InstructionContext>()); // TODO: This is buggy, we check only the top-level return instructions this way. Maybe some maniac returns from a method when in a subroutine?
 				LocalVariables lvs = f.getLocals();
 				for (int i=0; i<lvs.maxLocals(); i++){
 					if (lvs.get(i) instanceof UninitializedObjectType){

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java Fri Jul 22 04:34:27 2011
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -86,7 +87,7 @@ public class Subroutines{
 		private int localVariable = UNSET;
 
 		/** The instructions that belong to this subroutine. */
-		private Set instructions = new HashSet(); // Elements: InstructionHandle
+		private Set<InstructionHandle> instructions = new HashSet<InstructionHandle>(); // Elements: InstructionHandle
 		
 		/*
 		 * Refer to the Subroutine interface for documentation.
@@ -99,7 +100,7 @@ public class Subroutines{
 		 * The JSR or JSR_W instructions that define this
 		 * subroutine by targeting it.
 		 */
-		private Set theJSRs = new HashSet();
+		private Set<InstructionHandle> theJSRs = new HashSet<InstructionHandle>();
 		
 		/**
 		 * The RET instruction that leaves this subroutine.
@@ -141,10 +142,10 @@ public class Subroutines{
 			if (localVariable == UNSET){
 				throw new AssertionViolatedException("setLeavingRET() called for top-level 'subroutine' or forgot to set local variable first.");
 			}
-			Iterator iter = instructions.iterator();
+			Iterator<InstructionHandle> iter = instructions.iterator();
 			InstructionHandle ret = null;
 			while(iter.hasNext()){
-				InstructionHandle actual = (InstructionHandle) iter.next();
+				InstructionHandle actual = iter.next();
 				if (actual.getInstruction() instanceof RET){
 					if (ret != null){
 						throw new StructuralCodeConstraintException("Subroutine with more then one RET detected: '"+ret+"' and '"+actual+"'.");
@@ -171,7 +172,7 @@ public class Subroutines{
 				throw new AssertionViolatedException("getLeavingRET() called on top level pseudo-subroutine.");
 			}
 			InstructionHandle[] jsrs = new InstructionHandle[theJSRs.size()];
-			return (InstructionHandle[]) (theJSRs.toArray(jsrs));
+			return theJSRs.toArray(jsrs);
 		}
 	
 		/**
@@ -210,7 +211,7 @@ public class Subroutines{
 		 */
 		public InstructionHandle[] getInstructions(){
 			InstructionHandle[] ret = new InstructionHandle[instructions.size()];
-			return (InstructionHandle[]) instructions.toArray(ret);
+			return instructions.toArray(ret);
 		}
 		
 		/*
@@ -227,18 +228,18 @@ public class Subroutines{
 
 		/* Satisfies Subroutine.getRecursivelyAccessedLocalsIndices(). */
 		public int[] getRecursivelyAccessedLocalsIndices(){
-			Set s = new HashSet();
+			Set<Integer> s = new HashSet<Integer>();
 			int[] lvs = getAccessedLocalsIndices();
 			for (int j=0; j<lvs.length; j++){
-				s.add(new Integer(lvs[j]));
+				s.add(Integer.valueOf(lvs[j]));
 			}
 			_getRecursivelyAccessedLocalsIndicesHelper(s, this.subSubs());
 			int[] ret = new int[s.size()];
-			Iterator i = s.iterator();
+			Iterator<Integer> i = s.iterator();
 			int j=-1;
 			while (i.hasNext()){
 				j++;
-				ret[j] = ((Integer) i.next()).intValue();
+				ret[j] = i.next().intValue();
 			}
 			return ret;
 		}
@@ -247,7 +248,7 @@ public class Subroutines{
 		 * A recursive helper method for getRecursivelyAccessedLocalsIndices().
 		 * @see #getRecursivelyAccessedLocalsIndices()
 		 */
-		private void _getRecursivelyAccessedLocalsIndicesHelper(Set s, Subroutine[] subs){
+		private void _getRecursivelyAccessedLocalsIndicesHelper(Set<Integer> s, Subroutine[] subs){
 			for (int i=0; i<subs.length; i++){
 				int[] lvs = subs[i].getAccessedLocalsIndices();
 				for (int j=0; j<lvs.length; j++){
@@ -264,60 +265,64 @@ public class Subroutines{
 		 */
 		public int[] getAccessedLocalsIndices(){
 			//TODO: Implement caching.
-			Set acc = new HashSet();
+			Set<Integer> acc = new HashSet<Integer>();
 			if (theRET == null && this != TOPLEVEL){
 				throw new AssertionViolatedException("This subroutine object must be built up completely before calculating accessed locals.");
 			}
-			Iterator i = instructions.iterator();
-			while (i.hasNext()){
-				InstructionHandle ih = (InstructionHandle) i.next();
-				// RET is not a LocalVariableInstruction in the current version of BCEL.
-				if (ih.getInstruction() instanceof LocalVariableInstruction || ih.getInstruction() instanceof RET){
-					int idx = ((IndexedInstruction) (ih.getInstruction())).getIndex();
-					acc.add(new Integer(idx));
-					// LONG? DOUBLE?.
-					try{
-						// LocalVariableInstruction instances are typed without the need to look into
-						// the constant pool.
-						if (ih.getInstruction() instanceof LocalVariableInstruction){
-							int s = ((LocalVariableInstruction) ih.getInstruction()).getType(null).getSize();
-							if (s==2) {
-                                acc.add(new Integer(idx+1));
-                            }
-						}
-					}
-					catch(RuntimeException re){
-						throw new AssertionViolatedException("Oops. BCEL did not like NULL as a ConstantPoolGen object.", re);
-					}
-				}
+			{
+    			Iterator<InstructionHandle> i = instructions.iterator();
+    			while (i.hasNext()){
+    				InstructionHandle ih = i.next();
+    				// RET is not a LocalVariableInstruction in the current version of BCEL.
+    				if (ih.getInstruction() instanceof LocalVariableInstruction || ih.getInstruction() instanceof RET){
+    					int idx = ((IndexedInstruction) (ih.getInstruction())).getIndex();
+    					acc.add(new Integer(idx));
+    					// LONG? DOUBLE?.
+    					try{
+    						// LocalVariableInstruction instances are typed without the need to look into
+    						// the constant pool.
+    						if (ih.getInstruction() instanceof LocalVariableInstruction){
+    							int s = ((LocalVariableInstruction) ih.getInstruction()).getType(null).getSize();
+    							if (s==2) {
+                                    acc.add(new Integer(idx+1));
+                                }
+    						}
+    					}
+    					catch(RuntimeException re){
+    						throw new AssertionViolatedException("Oops. BCEL did not like NULL as a ConstantPoolGen object.", re);
+    					}
+    				}
+    			}
 			}
 			
-			int[] ret = new int[acc.size()];
-			i = acc.iterator();
-			int j=-1;
-			while (i.hasNext()){
-				j++;
-				ret[j] = ((Integer) i.next()).intValue();
+			{
+    			int[] ret = new int[acc.size()];
+    			Iterator<Integer> i = acc.iterator();
+    			int j=-1;
+    			while (i.hasNext()){
+    				j++;
+    				ret[j] = i.next().intValue();
+    			}
+    			return ret;
 			}
-			return ret;
 		}
 
 		/*
 		 * Satisfies Subroutine.subSubs().
 		 */
 		public Subroutine[] subSubs(){
-			Set h = new HashSet();
+			Set<Subroutine> h = new HashSet<Subroutine>();
 
-			Iterator i = instructions.iterator();
+			Iterator<InstructionHandle> i = instructions.iterator();
 			while (i.hasNext()){
-				Instruction inst = ((InstructionHandle) i.next()).getInstruction();
+				Instruction inst = i.next().getInstruction();
 				if (inst instanceof JsrInstruction){
 					InstructionHandle targ = ((JsrInstruction) inst).getTarget();
 					h.add(getSubroutine(targ));
 				}
 			}
 			Subroutine[] ret = new Subroutine[h.size()];
-			return (Subroutine[]) h.toArray(ret);
+			return h.toArray(ret);
 		}
 		
 		/*
@@ -353,7 +358,7 @@ public class Subroutines{
 	 * Key: InstructionHandle of the leader of the subroutine.
 	 * Elements: SubroutineImpl objects.
 	 */
-	private Map subroutines = new HashMap();
+	private Map<InstructionHandle, Subroutine> subroutines = new HashMap<InstructionHandle, Subroutine>();
 
 	/**
 	 * This is referring to a special subroutine, namely the
@@ -377,7 +382,7 @@ public class Subroutines{
 		TOPLEVEL = new SubroutineImpl();
 
 		// Calculate "real" subroutines.
-		Set sub_leaders = new HashSet(); // Elements: InstructionHandle
+		Set<InstructionHandle> sub_leaders = new HashSet<InstructionHandle>(); // Elements: InstructionHandle
 		for (int i=0; i<all.length; i++){
 			Instruction inst = all[i].getInstruction();
 			if (inst instanceof JsrInstruction){
@@ -386,10 +391,10 @@ public class Subroutines{
 		}
  
 		// Build up the database.
-		Iterator iter = sub_leaders.iterator();
+		Iterator<InstructionHandle> iter = sub_leaders.iterator();
 		while (iter.hasNext()){
 			SubroutineImpl sr = new SubroutineImpl();
-			InstructionHandle astore = (InstructionHandle) (iter.next());
+			InstructionHandle astore = iter.next();
 			sr.setLocalVariable( ((ASTORE) (astore.getInstruction())).getIndex() );
 			subroutines.put(astore, sr);
 		}
@@ -413,21 +418,21 @@ public class Subroutines{
 		
 		// Now do a BFS from every subroutine leader to find all the
 		// instructions that belong to a subroutine.
-		Set instructions_assigned = new HashSet(); // we don't want to assign an instruction to two or more Subroutine objects.
+		Set<InstructionHandle> instructions_assigned = new HashSet<InstructionHandle>(); // we don't want to assign an instruction to two or more Subroutine objects.
 		
-		Map colors = new HashMap(); //Graph colouring. Key: InstructionHandle, Value: Integer .
+		Map<InstructionHandle, Integer> colors = new HashMap<InstructionHandle, Integer>(); //Graph colouring. Key: InstructionHandle, Value: Integer .
 		
 		iter = sub_leaders.iterator();
 		while (iter.hasNext()){
 			// Do some BFS with "actual" as the root of the graph.
-			InstructionHandle actual = (InstructionHandle) (iter.next());
+			InstructionHandle actual = iter.next();
 			// Init colors
 			for (int i=0; i<all.length; i++){
 				colors.put(all[i], WHITE);
 			}
 			colors.put(actual, GRAY);
 			// Init Queue
-			ArrayList Q = new ArrayList();
+			List<InstructionHandle> Q = new ArrayList<InstructionHandle>();
 			Q.add(actual); // add(Obj) adds to the end, remove(0) removes from the start.
 			
 			/* BFS ALGORITHM MODIFICATION: Start out with multiple "root" nodes, as exception handlers are starting points of top-level code, too. [why top-level? TODO: Refer to the special JustIce notion of subroutines.]*/
@@ -441,10 +446,10 @@ public class Subroutines{
 			
 			// Loop until Queue is empty
 			while (Q.size() != 0){
-				InstructionHandle u = (InstructionHandle) Q.remove(0);
+				InstructionHandle u = Q.remove(0);
 				InstructionHandle[] successors = getSuccessors(u);
 				for (int i=0; i<successors.length; i++){
-					if (((Integer) colors.get(successors[i])) == WHITE){
+					if (colors.get(successors[i]) == WHITE){
 						colors.put(successors[i], GRAY);
 						Q.add(successors[i]);
 					}
@@ -473,9 +478,9 @@ public class Subroutines{
 		for (int i=0; i<handlers.length; i++){
 			InstructionHandle _protected = handlers[i].getStartPC();
 			while (_protected != handlers[i].getEndPC().getNext()){// Note the inclusive/inclusive notation of "generic API" exception handlers!
-				Iterator subs = subroutines.values().iterator();
+				Iterator<Subroutine> subs = subroutines.values().iterator();
 				while (subs.hasNext()){
-					Subroutine sub = (Subroutine) subs.next();
+					Subroutine sub = subs.next();
 					if (sub != subroutines.get(all[0])){	// We don't want to forbid top-level exception handlers.
 						if (sub.contains(_protected)){
 							throw new StructuralCodeConstraintException("Subroutine instruction '"+_protected+"' is protected by an exception handler, '"+handlers[i]+"'. This is forbidden by the JustIce verifier due to its clear definition of subroutines.");
@@ -492,7 +497,7 @@ public class Subroutines{
 		// This includes that subroutines may not call themselves
 		// recursively, even not through intermediate calls to other
 		// subroutines.
-		noRecursiveCalls(getTopLevel(), new HashSet());
+		noRecursiveCalls(getTopLevel(), new HashSet<Integer>());
 
 	}
 
@@ -507,7 +512,7 @@ public class Subroutines{
 	 *
 	 * @throws StructuralCodeConstraintException if the above constraint is not satisfied.
 	 */
-	private void noRecursiveCalls(Subroutine sub, Set set){
+	private void noRecursiveCalls(Subroutine sub, Set<Integer> set){
 		Subroutine[] subs = sub.subSubs();
 
 		for (int i=0; i<subs.length; i++){
@@ -534,7 +539,7 @@ public class Subroutines{
 	 * @see #getTopLevel()
 	 */
 	public Subroutine getSubroutine(InstructionHandle leader){
-		Subroutine ret = (Subroutine) subroutines.get(leader);
+		Subroutine ret = subroutines.get(leader);
 		
 		if (ret == null){
 			throw new AssertionViolatedException("Subroutine requested for an InstructionHandle that is not a leader of a subroutine.");
@@ -559,9 +564,9 @@ public class Subroutines{
 	 * @see #getTopLevel()
 	 */
 	public Subroutine subroutineOf(InstructionHandle any){
-		Iterator i = subroutines.values().iterator();
+		Iterator<Subroutine> i = subroutines.values().iterator();
 		while (i.hasNext()){
-			Subroutine s = (Subroutine) i.next();
+			Subroutine s = i.next();
 			if (s.contains(any)) {
                 return s;
             }

Modified: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java?rev=1149459&r1=1149458&r2=1149459&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java (original)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java Fri Jul 22 04:34:27 2011
@@ -134,7 +134,6 @@ public class AnnotationGenTestCase exten
 		try
 		{
 			String beforeName = a.getTypeName();
-			List beforeValues = a.getValues();
 			ByteArrayOutputStream baos = new ByteArrayOutputStream();
 			DataOutputStream dos = new DataOutputStream(baos);
 			a.dump(dos);
@@ -147,7 +146,6 @@ public class AnnotationGenTestCase exten
 					.isRuntimeVisible());
 			dis.close();
 			String afterName = annAfter.getTypeName();
-			List afterValues = annAfter.getValues();
 			if (!beforeName.equals(afterName))
 			{
 				fail("Deserialization failed: before type='" + beforeName
@@ -161,10 +159,8 @@ public class AnnotationGenTestCase exten
 			}
 			for (int i = 0; i < a.getValues().size(); i++)
 			{
-				ElementValuePairGen beforeElement = (ElementValuePairGen) a
-						.getValues().get(i);
-				ElementValuePairGen afterElement = (ElementValuePairGen) annAfter
-						.getValues().get(i);
+				ElementValuePairGen beforeElement = a.getValues().get(i);
+				ElementValuePairGen afterElement = annAfter.getValues().get(i);
 				if (!beforeElement.getNameString().equals(
 						afterElement.getNameString()))
 				{



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org


Mime
View raw message