From: markt Date: Fri, 3 Sep 2010 18:50:57 +0000 (+0000) Subject: https://issues.apache.org/bugzilla/show_bug.cgi?id=49876 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6e0c24246ca369e3d545581f530d1bd4eb8daf24;p=tomcat7.0 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) git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@992416 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java b/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java index 4125fdf18..980c74dee 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java +++ b/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java @@ -40,7 +40,7 @@ public class AnnotationEntry implements Constants, Serializable { private int type_index; private ConstantPool constant_pool; - private List element_value_pairs; + private List element_value_pairs; /** * Factory method to create an AnnotionEntry from a DataInputStream @@ -54,7 +54,7 @@ public class AnnotationEntry implements Constants, Serializable { 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(); 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 Constants, Serializable { */ 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 Constants, Serializable { 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 readers = + new HashMap(); /* * Class method reads one attribute from the input data stream. This method @@ -124,7 +125,7 @@ public abstract class Attribute implements Cloneable, Serializable 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, diff --git a/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java b/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java index fd354ff5d..2032e7175 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java +++ b/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java @@ -35,7 +35,8 @@ import org.apache.tomcat.util.bcel.util.BCELComparator; * @version $Id$ * @author M. Dahm */ -public class JavaClass extends AccessFlags implements Cloneable, Comparable { +public class JavaClass extends AccessFlags + implements Cloneable, Comparable { private static final long serialVersionUID = 7029227708237523236L; private String file_name; @@ -155,7 +156,7 @@ public class JavaClass extends AccessFlags implements Cloneable, Comparable { if (annotationsOutOfDate) { // Find attributes that contain annotation data Attribute[] attrs = getAttributes(); - List accumulatedAnnotations = new ArrayList(); + List accumulatedAnnotations = new ArrayList(); for (int i = 0; i < attrs.length; i++) { Attribute attribute = attrs[i]; if (attribute instanceof Annotations) { @@ -164,7 +165,7 @@ public class JavaClass extends AccessFlags implements Cloneable, Comparable { 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 AccessFlags implements Cloneable, Comparable { * 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()); } diff --git a/java/org/apache/tomcat/util/bcel/classfile/Unknown.java b/java/org/apache/tomcat/util/bcel/classfile/Unknown.java index a1aea565a..aae39578d 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/Unknown.java +++ b/java/org/apache/tomcat/util/bcel/classfile/Unknown.java @@ -46,7 +46,8 @@ public final class Unknown extends Attribute { private static final long serialVersionUID = -4152422704743201314L; private byte[] bytes; private String name; - private static final Map unknown_attributes = new HashMap(); + private static final Map unknown_attributes = + new HashMap(); /** diff --git a/java/org/apache/tomcat/util/bcel/classfile/Utility.java b/java/org/apache/tomcat/util/bcel/classfile/Utility.java index 7aae6b2ae..c97358e92 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/Utility.java +++ b/java/org/apache/tomcat/util/bcel/classfile/Utility.java @@ -30,19 +30,19 @@ import org.apache.tomcat.util.bcel.util.ByteSequence; */ public abstract class Utility { - private static int unwrap( ThreadLocal tl ) { - return ((Integer) tl.get()).intValue(); + private static int unwrap( ThreadLocal tl ) { + return tl.get().intValue(); } - private static void wrap( ThreadLocal tl, int value ) { + private static void wrap( ThreadLocal tl, int value ) { tl.set(new Integer(value)); } - private static ThreadLocal consumed_chars = new ThreadLocal() { - + private static ThreadLocal consumed_chars = + new ThreadLocal() { @Override - protected Object initialValue() { + protected Integer initialValue() { return new Integer(0); } };/* How many chars have been consumed diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 8e4245ab5..348b1a233 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -110,6 +110,10 @@ Keep the MBean names for web applications consistent between Tomcat 6 and Tomcat 7. (markt) + + 49876: Fix the generics warnings in the copied Apache Jakarta + BCEL code. Based on a patch by Gábor. (markt) +