# HG changeset patch # User jjg # Date 1211497560 25200 # Node ID 4718b910737c9912d35d83cf849de06a9ad43b5e # Parent 1ebc7ce89018363023c6994863dd8720ca6bcc11 6657909: javap has unchecked compilation warnings Reviewed-by: mcimadamore diff -r 1ebc7ce89018 -r 4718b910737c langtools/src/share/classes/sun/tools/javap/ClassData.java --- a/langtools/src/share/classes/sun/tools/javap/ClassData.java Thu May 22 15:51:41 2008 -0700 +++ b/langtools/src/share/classes/sun/tools/javap/ClassData.java Thu May 22 16:06:00 2008 -0700 @@ -58,7 +58,7 @@ private String superclassname; private int source_cpx=0; private byte tags[]; - private Hashtable indexHashAscii = new Hashtable(); + private Hashtable indexHashAscii = new Hashtable(); private String pkgPrefix=""; private int pkgPrefixLen=0; @@ -167,19 +167,19 @@ switch(tags[i] = tag) { case CONSTANT_UTF8: String str=in.readUTF(); - indexHashAscii.put(cpool[i] = str, new Integer(i)); + indexHashAscii.put(cpool[i] = str, i); break; case CONSTANT_INTEGER: - cpool[i] = new Integer(in.readInt()); + cpool[i] = Integer.valueOf(in.readInt()); break; case CONSTANT_FLOAT: - cpool[i] = new Float(in.readFloat()); + cpool[i] = Float.valueOf(in.readFloat()); break; case CONSTANT_LONG: - cpool[i++] = new Long(in.readLong()); + cpool[i++] = Long.valueOf(in.readLong()); break; case CONSTANT_DOUBLE: - cpool[i++] = new Double(in.readDouble()); + cpool[i++] = Double.valueOf(in.readDouble()); break; case CONSTANT_CLASS: case CONSTANT_STRING: @@ -365,7 +365,7 @@ * Returns the access of this class or interface. */ public String[] getAccess(){ - Vector v = new Vector(); + Vector v = new Vector(); if ((access & ACC_PUBLIC) !=0) v.addElement("public"); if ((access & ACC_FINAL) !=0) v.addElement("final"); if ((access & ACC_ABSTRACT) !=0) v.addElement("abstract"); diff -r 1ebc7ce89018 -r 4718b910737c langtools/src/share/classes/sun/tools/javap/FieldData.java --- a/langtools/src/share/classes/sun/tools/javap/FieldData.java Thu May 22 15:51:41 2008 -0700 +++ b/langtools/src/share/classes/sun/tools/javap/FieldData.java Thu May 22 16:06:00 2008 -0700 @@ -45,7 +45,7 @@ int value_cpx=0; boolean isSynthetic=false; boolean isDeprecated=false; - Vector attrs; + Vector attrs; public FieldData(ClassData cls){ this.cls=cls; @@ -60,7 +60,7 @@ descriptor_index = in.readUnsignedShort(); // Read the attributes int attributes_count = in.readUnsignedShort(); - attrs=new Vector(attributes_count); + attrs=new Vector(attributes_count); for (int i = 0; i < attributes_count; i++) { int attr_name_index=in.readUnsignedShort(); if (cls.getTag(attr_name_index)!=CONSTANT_UTF8) continue; @@ -99,7 +99,7 @@ * Returns access of a field. */ public String[] getAccess(){ - Vector v = new Vector(); + Vector v = new Vector(); if ((access & ACC_PUBLIC) !=0) v.addElement("public"); if ((access & ACC_PRIVATE) !=0) v.addElement("private"); if ((access & ACC_PROTECTED) !=0) v.addElement("protected"); diff -r 1ebc7ce89018 -r 4718b910737c langtools/src/share/classes/sun/tools/javap/InnerClassData.java --- a/langtools/src/share/classes/sun/tools/javap/InnerClassData.java Thu May 22 15:51:41 2008 -0700 +++ b/langtools/src/share/classes/sun/tools/javap/InnerClassData.java Thu May 22 16:06:00 2008 -0700 @@ -63,7 +63,7 @@ * Returns the access of this class or interface. */ public String[] getAccess(){ - Vector v = new Vector(); + Vector v = new Vector(); if ((access & ACC_PUBLIC) !=0) v.addElement("public"); if ((access & ACC_FINAL) !=0) v.addElement("final"); if ((access & ACC_ABSTRACT) !=0) v.addElement("abstract"); diff -r 1ebc7ce89018 -r 4718b910737c langtools/src/share/classes/sun/tools/javap/JavapPrinter.java --- a/langtools/src/share/classes/sun/tools/javap/JavapPrinter.java Thu May 22 15:51:41 2008 -0700 +++ b/langtools/src/share/classes/sun/tools/javap/JavapPrinter.java Thu May 22 16:06:00 2008 -0700 @@ -653,7 +653,7 @@ case CONSTANT_METHOD: case CONSTANT_INTERFACEMETHOD: case CONSTANT_FIELD: { - CPX2 x = (CPX2)(cls.getCpoolEntry(cpx)); + CPX2 x = cls.getCpoolEntry(cpx); if (x.cpx1 == cls.getthis_cpx()) { // don't print class part for local references cpx=x.cpx2; @@ -851,7 +851,7 @@ case CONSTANT_INTERFACEMETHOD: case CONSTANT_FIELD: { // CPX2 x=(CPX2)(cpool[cpx]); - CPX2 x = (CPX2)(cls.getCpoolEntry(cpx)); + CPX2 x = cls.getCpoolEntry(cpx); if (x.cpx1 == cls.getthis_cpx()) { // don't print class part for local references cpx=x.cpx2; diff -r 1ebc7ce89018 -r 4718b910737c langtools/src/share/classes/sun/tools/javap/Main.java --- a/langtools/src/share/classes/sun/tools/javap/Main.java Thu May 22 15:51:41 2008 -0700 +++ b/langtools/src/share/classes/sun/tools/javap/Main.java Thu May 22 16:06:00 2008 -0700 @@ -35,9 +35,9 @@ * * @author Sucheta Dambalkar (Adopted code from old javap) */ -public class Main{ +public class Main { - private Vector classList = new Vector(); + private Vector classList = new Vector(); private PrintWriter out; JavapEnvironment env = new JavapEnvironment(); private static boolean errorOccurred = false; @@ -201,7 +201,7 @@ */ private void displayResults() { for (int i = 0; i < classList.size() ; i++ ) { - String Name = (String)classList.elementAt(i); + String Name = classList.elementAt(i); InputStream classin = env.getFileInputStream(Name); try { diff -r 1ebc7ce89018 -r 4718b910737c langtools/src/share/classes/sun/tools/javap/MethodData.java --- a/langtools/src/share/classes/sun/tools/javap/MethodData.java Thu May 22 15:51:41 2008 -0700 +++ b/langtools/src/share/classes/sun/tools/javap/MethodData.java Thu May 22 16:06:00 2008 -0700 @@ -43,14 +43,14 @@ int descriptor_index; int attributes_count; byte[] code; - Vector exception_table = new Vector(0); - Vector lin_num_tb = new Vector(0); - Vector loc_var_tb = new Vector(0); + Vector exception_table = new Vector(0); + Vector lin_num_tb = new Vector(0); + Vector loc_var_tb = new Vector(0); StackMapTableData[] stackMapTable; StackMapData[] stackMap; int[] exc_index_table=null; - Vector attrs=new Vector(0); - Vector code_attrs=new Vector(0); + Vector attrs=new Vector(0); + Vector code_attrs=new Vector(0); int max_stack, max_locals; boolean isSynthetic=false; boolean isDeprecated=false; @@ -165,7 +165,7 @@ */ void readExceptionTable (DataInputStream in) throws IOException { int exception_table_len=in.readUnsignedShort(); - exception_table=new Vector(exception_table_len); + exception_table=new Vector(exception_table_len); for (int l = 0; l < exception_table_len; l++) { exception_table.addElement(new TrapData(in, l)); } @@ -177,7 +177,7 @@ void readLineNumTable (DataInputStream in) throws IOException { int attr_len = in.readInt(); // attr_length int lin_num_tb_len = in.readUnsignedShort(); - lin_num_tb=new Vector(lin_num_tb_len); + lin_num_tb=new Vector(lin_num_tb_len); for (int l = 0; l < lin_num_tb_len; l++) { lin_num_tb.addElement(new LineNumData(in)); } @@ -189,7 +189,7 @@ void readLocVarTable (DataInputStream in) throws IOException { int attr_len=in.readInt(); // attr_length int loc_var_tb_len = in.readUnsignedShort(); - loc_var_tb = new Vector(loc_var_tb_len); + loc_var_tb = new Vector(loc_var_tb_len); for (int l = 0; l < loc_var_tb_len; l++) { loc_var_tb.addElement(new LocVarData(in)); } @@ -237,7 +237,7 @@ */ public String[] getAccess(){ - Vector v = new Vector(); + Vector v = new Vector(); if ((access & ACC_PUBLIC) !=0) v.addElement("public"); if ((access & ACC_PRIVATE) !=0) v.addElement("private"); if ((access & ACC_PROTECTED) !=0) v.addElement("protected"); diff -r 1ebc7ce89018 -r 4718b910737c langtools/src/share/classes/sun/tools/javap/Tables.java --- a/langtools/src/share/classes/sun/tools/javap/Tables.java Thu May 22 15:51:41 2008 -0700 +++ b/langtools/src/share/classes/sun/tools/javap/Tables.java Thu May 22 16:06:00 2008 -0700 @@ -26,8 +26,6 @@ package sun.tools.javap; -import java.io.IOException; -import java.io.InputStream; import java.util.Hashtable; import java.util.Vector; @@ -36,14 +34,14 @@ /** * Define mnemocodes table. */ - static Hashtable mnemocodes = new Hashtable(301, 0.5f); + static Hashtable mnemocodes = new Hashtable(301, 0.5f); static String opcExtNamesTab[]=new String[128]; static String opcPrivExtNamesTab[]=new String[128]; static void defineNonPriv(int opc, String mnem) { - mnemocodes.put(opcExtNamesTab[opc]=mnem, new Integer(opc_nonpriv*256+opc)); + mnemocodes.put(opcExtNamesTab[opc]=mnem, opc_nonpriv*256+opc); } static void definePriv(int opc, String mnem) { - mnemocodes.put(opcPrivExtNamesTab[opc]="priv_"+mnem, new Integer(opc_priv*256+opc)); + mnemocodes.put(opcPrivExtNamesTab[opc]="priv_"+mnem, opc_priv*256+opc); } static void defineExt(int opc, String mnem) { defineNonPriv(opc, mnem); @@ -51,28 +49,28 @@ } static { int k; for (k=0; k keywordNames = new Vector(40); private static void defineKeywordName(String id, int token) { if (token>=keywordNames.size()) { @@ -202,7 +200,7 @@ public static String keywordName(int token) { if (token==-1) return "EOF"; if (token>=keywordNames.size()) return null; - return (String)keywordNames.elementAt(token); + return keywordNames.elementAt(token); } static { defineKeywordName("ident", IDENT); @@ -217,15 +215,15 @@ defineKeywordName("RBRACE", RBRACE); } - static Hashtable keywords = new Hashtable(40); + static Hashtable keywords = new Hashtable(40); public static int keyword(String idValue) { - Integer Val=(Integer)(keywords.get(idValue)); - if (Val == null) return IDENT; - return Val.intValue(); + Integer val=keywords.get(idValue); + if (val == null) return IDENT; + return val.intValue(); } private static void defineKeyword(String id, int token) { - keywords.put(id, new Integer(token)); + keywords.put(id, token); defineKeywordName(id, token); } static { @@ -275,8 +273,8 @@ /** * Define tag table. */ - private static Vector tagNames = new Vector(10); - private static Hashtable Tags = new Hashtable(10); + private static Vector tagNames = new Vector(10); + private static Hashtable Tags = new Hashtable(10); static { defineTag("Asciz",CONSTANT_UTF8); defineTag("int",CONSTANT_INTEGER); @@ -291,7 +289,7 @@ defineTag("NameAndType",CONSTANT_NAMEANDTYPE); } private static void defineTag(String id, int val) { - Tags.put(id, new Integer(val)); + Tags.put(id, val); if (val>=tagNames.size()) { tagNames.setSize(val+1); } @@ -299,10 +297,10 @@ } public static String tagName(int tag) { if (tag>=tagNames.size()) return null; - return (String)tagNames.elementAt(tag); + return tagNames.elementAt(tag); } public static int tagValue(String idValue) { - Integer Val=(Integer)(Tags.get(idValue)); + Integer Val=Tags.get(idValue); if (Val == null) return 0; return Val.intValue(); } @@ -310,8 +308,8 @@ /** * Define type table. These types used in "newarray" instruction only. */ - private static Vector typeNames = new Vector(10); - private static Hashtable Types = new Hashtable(10); + private static Vector typeNames = new Vector(10); + private static Hashtable Types = new Hashtable(10); static { defineType("int",T_INT); defineType("long",T_LONG); @@ -324,28 +322,28 @@ defineType("short",T_SHORT); } private static void defineType(String id, int val) { - Types.put(id, new Integer(val)); + Types.put(id, val); if (val>=typeNames.size()) { typeNames.setSize(val+1); } typeNames.setElementAt(id, val); } public static int typeValue(String idValue) { - Integer Val=(Integer)(Types.get(idValue)); + Integer Val=Types.get(idValue); if (Val == null) return -1; return Val.intValue(); } public static String typeName(int type) { if (type>=typeNames.size()) return null; - return (String)typeNames.elementAt(type); + return typeNames.elementAt(type); } /** * Define MapTypes table. * These constants used in stackmap tables only. */ - private static Vector mapTypeNames = new Vector(10); - private static Hashtable MapTypes = new Hashtable(10); + private static Vector mapTypeNames = new Vector(10); + private static Hashtable MapTypes = new Hashtable(10); static { defineMapType("bogus", ITEM_Bogus); defineMapType("int", ITEM_Integer); @@ -358,20 +356,20 @@ defineMapType("uninitialized", ITEM_NewObject); } private static void defineMapType(String id, int val) { - MapTypes.put(id, new Integer(val)); + MapTypes.put(id, val); if (val>=mapTypeNames.size()) { mapTypeNames.setSize(val+1); } mapTypeNames.setElementAt(id, val); } public static int mapTypeValue(String idValue) { - Integer Val=(Integer)(MapTypes.get(idValue)); + Integer Val=MapTypes.get(idValue); if (Val == null) return -1; return Val.intValue(); } public static String mapTypeName(int type) { if (type>=mapTypeNames.size()) return null; - return (String)mapTypeNames.elementAt(type); + return mapTypeNames.elementAt(type); } } diff -r 1ebc7ce89018 -r 4718b910737c langtools/src/share/classes/sun/tools/javap/TypeSignature.java --- a/langtools/src/share/classes/sun/tools/javap/TypeSignature.java Thu May 22 15:51:41 2008 -0700 +++ b/langtools/src/share/classes/sun/tools/javap/TypeSignature.java Thu May 22 16:06:00 2008 -0700 @@ -79,7 +79,7 @@ * Returns java type signature of a parameter. */ public String getParametersHelper(String parameterdes){ - Vector parameters = new Vector(); + Vector parameters = new Vector(); int startindex = -1; int endindex = -1; String param = ""; @@ -187,7 +187,7 @@ int i; for(i = 0; i < parameters.size(); i++){ - parametersignature += (String)parameters.elementAt(i); + parametersignature += parameters.elementAt(i); if(i != parameters.size()-1){ parametersignature += ", "; }