Author: markt Date: Fri Sep 3 18:50:57 2010 New Revision: 992416 URL: http://svn.apache.org/viewvc?rev=992416&view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=49876 Generics warnings in the copied Apache Jakarta BCEL code. Based on a patch by Gábor. (markt)
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java?rev=992416&r1=992415&r2=992416&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java Fri Sep 3 18:50:57 2010 @@ -40,7 +40,7 @@ public class AnnotationEntry implements private int type_index; private ConstantPool constant_pool; - private List element_value_pairs; + private List<ElementValuePair> element_value_pairs; /** * Factory method to create an AnnotionEntry from a DataInputStream @@ -54,7 +54,7 @@ public class AnnotationEntry implements final AnnotationEntry annotationEntry = new AnnotationEntry(file.readUnsignedShort(), constant_pool); final int num_element_value_pairs = (file.readUnsignedShort()); - annotationEntry.element_value_pairs = new ArrayList(); + annotationEntry.element_value_pairs = new ArrayList<ElementValuePair>(); for (int i = 0; i < num_element_value_pairs; i++) { annotationEntry.element_value_pairs.add(new ElementValuePair(file.readUnsignedShort(), ElementValue.readElementValue(file, constant_pool), constant_pool)); @@ -80,7 +80,7 @@ public class AnnotationEntry implements */ public ElementValuePair[] getElementValuePairs() { // TOFO return List - return (ElementValuePair[]) element_value_pairs.toArray(new ElementValuePair[element_value_pairs.size()]); + return element_value_pairs.toArray(new ElementValuePair[element_value_pairs.size()]); } @@ -89,7 +89,7 @@ public class AnnotationEntry implements dos.writeShort(type_index); // u2 index of type name in cpool dos.writeShort(element_value_pairs.size()); // u2 element_value pair count for (int i = 0 ; i<element_value_pairs.size();i++) { - ElementValuePair envp = (ElementValuePair) element_value_pairs.get(i); + ElementValuePair envp = element_value_pairs.get(i); envp.dump(dos); } } Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=992416&r1=992415&r2=992416&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri Sep 3 18:50:57 2010 @@ -82,7 +82,8 @@ public abstract class Attribute implemen file.writeInt(length); } - private static final Map readers = new HashMap(); + private static final Map<String,AttributeReader> readers = + new HashMap<String,AttributeReader>(); /* * Class method reads one attribute from the input data stream. This method @@ -124,7 +125,7 @@ public abstract class Attribute implemen switch (tag) { case Constants.ATTR_UNKNOWN: - AttributeReader r = (AttributeReader) readers.get(name); + AttributeReader r = readers.get(name); if (r != null) { return r.createAttribute(name_index, length, file, Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java?rev=992416&r1=992415&r2=992416&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java Fri Sep 3 18:50:57 2010 @@ -35,7 +35,8 @@ import org.apache.tomcat.util.bcel.util. * @version $Id$ * @author <A HREF="mailto:m.d...@gmx.de">M. Dahm</A> */ -public class JavaClass extends AccessFlags implements Cloneable, Comparable { +public class JavaClass extends AccessFlags + implements Cloneable, Comparable<JavaClass> { private static final long serialVersionUID = 7029227708237523236L; private String file_name; @@ -155,7 +156,7 @@ public class JavaClass extends AccessFla if (annotationsOutOfDate) { // Find attributes that contain annotation data Attribute[] attrs = getAttributes(); - List accumulatedAnnotations = new ArrayList(); + List<AnnotationEntry> accumulatedAnnotations = new ArrayList<AnnotationEntry>(); for (int i = 0; i < attrs.length; i++) { Attribute attribute = attrs[i]; if (attribute instanceof Annotations) { @@ -164,7 +165,7 @@ public class JavaClass extends AccessFla accumulatedAnnotations.add(runtimeAnnotations.getAnnotationEntries()[j]); } } - annotations = (AnnotationEntry[])accumulatedAnnotations.toArray(new AnnotationEntry[accumulatedAnnotations.size()]); + annotations = accumulatedAnnotations.toArray(new AnnotationEntry[accumulatedAnnotations.size()]); annotationsOutOfDate = false; } return annotations; @@ -266,8 +267,8 @@ public class JavaClass extends AccessFla * This ordering is based on the class name */ @Override - public int compareTo( Object obj ) { - return getClassName().compareTo(((JavaClass) obj).getClassName()); + public int compareTo(JavaClass obj) { + return getClassName().compareTo(obj.getClassName()); } Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java?rev=992416&r1=992415&r2=992416&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java Fri Sep 3 18:50:57 2010 @@ -46,7 +46,8 @@ public final class Unknown extends Attri private static final long serialVersionUID = -4152422704743201314L; private byte[] bytes; private String name; - private static final Map unknown_attributes = new HashMap(); + private static final Map<String, Unknown> unknown_attributes = + new HashMap<String, Unknown>(); /** 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=992416&r1=992415&r2=992416&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 Fri Sep 3 18:50:57 2010 @@ -30,19 +30,19 @@ import org.apache.tomcat.util.bcel.util. */ public abstract class Utility { - 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)); } - private static ThreadLocal consumed_chars = new ThreadLocal() { - + private static ThreadLocal<Integer> consumed_chars = + new ThreadLocal<Integer>() { @Override - protected Object initialValue() { + protected Integer initialValue() { return new Integer(0); } };/* How many chars have been consumed Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=992416&r1=992415&r2=992416&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Fri Sep 3 18:50:57 2010 @@ -110,6 +110,10 @@ Keep the MBean names for web applications consistent between Tomcat 6 and Tomcat 7. (markt) </fix> + <fix> + <bug>49876</bug>: Fix the generics warnings in the copied Apache Jakarta + BCEL code. Based on a patch by Gábor. (markt) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org