Merge

Wed, 28 May 2008 00:02:28 -0700

author
tbell
date
Wed, 28 May 2008 00:02:28 -0700
changeset 39
ff3d4fdf9c63
parent 35
4ef4bd318569
parent 38
65a447c75d4b
child 43
fc780e96a16a

Merge

     1.1 --- a/src/share/classes/com/sun/tools/javac/util/JavacFileManager.java	Thu May 22 09:37:57 2008 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/util/JavacFileManager.java	Wed May 28 00:02:28 2008 -0700
     1.3 @@ -1606,7 +1606,7 @@
     1.4          /** @deprecated see bug 6410637 */
     1.5          @Deprecated
     1.6          public String getPath() {
     1.7 -            return entry.getName() + "(" + entry + ")";
     1.8 +            return zipName + "(" + entry.getName() + ")";
     1.9          }
    1.10  
    1.11          public long getLastModified() {
     2.1 --- a/src/share/classes/com/sun/tools/javac/zip/ZipFileIndex.java	Thu May 22 09:37:57 2008 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/javac/zip/ZipFileIndex.java	Wed May 28 00:02:28 2008 -0700
     2.3 @@ -1,3 +1,28 @@
     2.4 +/*
     2.5 + * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.  Sun designates this
    2.11 + * particular file as subject to the "Classpath" exception as provided
    2.12 + * by Sun in the LICENSE file that accompanied this code.
    2.13 + *
    2.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.17 + * version 2 for more details (a copy is included in the LICENSE file that
    2.18 + * accompanied this code).
    2.19 + *
    2.20 + * You should have received a copy of the GNU General Public License version
    2.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.23 + *
    2.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    2.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    2.26 + * have any questions.
    2.27 + */
    2.28 +
    2.29  package com.sun.tools.javac.zip;
    2.30  
    2.31  import java.io.*;
     3.1 --- a/src/share/classes/com/sun/tools/javac/zip/ZipFileIndexEntry.java	Thu May 22 09:37:57 2008 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/javac/zip/ZipFileIndexEntry.java	Wed May 28 00:02:28 2008 -0700
     3.3 @@ -1,3 +1,28 @@
     3.4 +/*
     3.5 + * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + *
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.  Sun designates this
    3.11 + * particular file as subject to the "Classpath" exception as provided
    3.12 + * by Sun in the LICENSE file that accompanied this code.
    3.13 + *
    3.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.17 + * version 2 for more details (a copy is included in the LICENSE file that
    3.18 + * accompanied this code).
    3.19 + *
    3.20 + * You should have received a copy of the GNU General Public License version
    3.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.23 + *
    3.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    3.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    3.26 + * have any questions.
    3.27 + */
    3.28 +
    3.29  package com.sun.tools.javac.zip;
    3.30  
    3.31  import java.io.File;
     4.1 --- a/src/share/classes/sun/tools/javap/ClassData.java	Thu May 22 09:37:57 2008 -0700
     4.2 +++ b/src/share/classes/sun/tools/javap/ClassData.java	Wed May 28 00:02:28 2008 -0700
     4.3 @@ -58,7 +58,7 @@
     4.4      private String superclassname;
     4.5      private int source_cpx=0;
     4.6      private byte tags[];
     4.7 -    private Hashtable indexHashAscii = new Hashtable();
     4.8 +    private Hashtable<Object,Integer> indexHashAscii = new Hashtable<Object,Integer>();
     4.9      private String pkgPrefix="";
    4.10      private int pkgPrefixLen=0;
    4.11  
    4.12 @@ -167,19 +167,19 @@
    4.13              switch(tags[i] = tag) {
    4.14              case CONSTANT_UTF8:
    4.15                  String str=in.readUTF();
    4.16 -                indexHashAscii.put(cpool[i] = str, new Integer(i));
    4.17 +                indexHashAscii.put(cpool[i] = str, i);
    4.18                  break;
    4.19              case CONSTANT_INTEGER:
    4.20 -                cpool[i] = new Integer(in.readInt());
    4.21 +                cpool[i] = Integer.valueOf(in.readInt());
    4.22                  break;
    4.23              case CONSTANT_FLOAT:
    4.24 -                cpool[i] = new Float(in.readFloat());
    4.25 +                cpool[i] = Float.valueOf(in.readFloat());
    4.26                  break;
    4.27              case CONSTANT_LONG:
    4.28 -                cpool[i++] = new Long(in.readLong());
    4.29 +                cpool[i++] = Long.valueOf(in.readLong());
    4.30                  break;
    4.31              case CONSTANT_DOUBLE:
    4.32 -                cpool[i++] = new Double(in.readDouble());
    4.33 +                cpool[i++] = Double.valueOf(in.readDouble());
    4.34                  break;
    4.35              case CONSTANT_CLASS:
    4.36              case CONSTANT_STRING:
    4.37 @@ -365,7 +365,7 @@
    4.38       * Returns the access of this class or interface.
    4.39       */
    4.40      public String[] getAccess(){
    4.41 -        Vector v = new Vector();
    4.42 +        Vector<String> v = new Vector<String>();
    4.43          if ((access & ACC_PUBLIC)   !=0) v.addElement("public");
    4.44          if ((access & ACC_FINAL)    !=0) v.addElement("final");
    4.45          if ((access & ACC_ABSTRACT) !=0) v.addElement("abstract");
     5.1 --- a/src/share/classes/sun/tools/javap/FieldData.java	Thu May 22 09:37:57 2008 -0700
     5.2 +++ b/src/share/classes/sun/tools/javap/FieldData.java	Wed May 28 00:02:28 2008 -0700
     5.3 @@ -45,7 +45,7 @@
     5.4      int value_cpx=0;
     5.5      boolean isSynthetic=false;
     5.6      boolean isDeprecated=false;
     5.7 -    Vector attrs;
     5.8 +    Vector<AttrData> attrs;
     5.9  
    5.10      public FieldData(ClassData cls){
    5.11          this.cls=cls;
    5.12 @@ -60,7 +60,7 @@
    5.13          descriptor_index = in.readUnsignedShort();
    5.14          // Read the attributes
    5.15          int attributes_count = in.readUnsignedShort();
    5.16 -        attrs=new Vector(attributes_count);
    5.17 +        attrs=new Vector<AttrData>(attributes_count);
    5.18          for (int i = 0; i < attributes_count; i++) {
    5.19              int attr_name_index=in.readUnsignedShort();
    5.20              if (cls.getTag(attr_name_index)!=CONSTANT_UTF8) continue;
    5.21 @@ -99,7 +99,7 @@
    5.22       * Returns access of a field.
    5.23       */
    5.24      public String[] getAccess(){
    5.25 -        Vector v = new Vector();
    5.26 +        Vector<String> v = new Vector<String>();
    5.27          if ((access & ACC_PUBLIC)   !=0) v.addElement("public");
    5.28          if ((access & ACC_PRIVATE)   !=0) v.addElement("private");
    5.29          if ((access & ACC_PROTECTED)   !=0) v.addElement("protected");
     6.1 --- a/src/share/classes/sun/tools/javap/InnerClassData.java	Thu May 22 09:37:57 2008 -0700
     6.2 +++ b/src/share/classes/sun/tools/javap/InnerClassData.java	Wed May 28 00:02:28 2008 -0700
     6.3 @@ -63,7 +63,7 @@
     6.4       * Returns the access of this class or interface.
     6.5       */
     6.6      public String[] getAccess(){
     6.7 -        Vector v = new Vector();
     6.8 +        Vector<String> v = new Vector<String>();
     6.9          if ((access & ACC_PUBLIC)   !=0) v.addElement("public");
    6.10          if ((access & ACC_FINAL)    !=0) v.addElement("final");
    6.11          if ((access & ACC_ABSTRACT) !=0) v.addElement("abstract");
     7.1 --- a/src/share/classes/sun/tools/javap/JavapPrinter.java	Thu May 22 09:37:57 2008 -0700
     7.2 +++ b/src/share/classes/sun/tools/javap/JavapPrinter.java	Wed May 28 00:02:28 2008 -0700
     7.3 @@ -653,7 +653,7 @@
     7.4          case CONSTANT_METHOD:
     7.5          case CONSTANT_INTERFACEMETHOD:
     7.6          case CONSTANT_FIELD: {
     7.7 -            CPX2 x = (CPX2)(cls.getCpoolEntry(cpx));
     7.8 +            CPX2 x = cls.getCpoolEntry(cpx);
     7.9              if (x.cpx1 == cls.getthis_cpx()) {
    7.10                  // don't print class part for local references
    7.11                  cpx=x.cpx2;
    7.12 @@ -851,7 +851,7 @@
    7.13          case CONSTANT_INTERFACEMETHOD:
    7.14          case CONSTANT_FIELD: {
    7.15              // CPX2 x=(CPX2)(cpool[cpx]);
    7.16 -            CPX2 x = (CPX2)(cls.getCpoolEntry(cpx));
    7.17 +            CPX2 x = cls.getCpoolEntry(cpx);
    7.18              if (x.cpx1 == cls.getthis_cpx()) {
    7.19                  // don't print class part for local references
    7.20                  cpx=x.cpx2;
     8.1 --- a/src/share/classes/sun/tools/javap/Main.java	Thu May 22 09:37:57 2008 -0700
     8.2 +++ b/src/share/classes/sun/tools/javap/Main.java	Wed May 28 00:02:28 2008 -0700
     8.3 @@ -35,9 +35,9 @@
     8.4   *
     8.5   * @author  Sucheta Dambalkar (Adopted code from old javap)
     8.6   */
     8.7 -public class Main{
     8.8 +public class Main {
     8.9  
    8.10 -    private Vector classList = new Vector();
    8.11 +    private Vector<String> classList = new Vector<String>();
    8.12      private PrintWriter out;
    8.13      JavapEnvironment env = new JavapEnvironment();
    8.14      private static boolean errorOccurred = false;
    8.15 @@ -201,7 +201,7 @@
    8.16       */
    8.17      private void displayResults() {
    8.18          for (int i = 0; i < classList.size() ; i++ ) {
    8.19 -            String Name = (String)classList.elementAt(i);
    8.20 +            String Name = classList.elementAt(i);
    8.21              InputStream classin = env.getFileInputStream(Name);
    8.22  
    8.23              try {
     9.1 --- a/src/share/classes/sun/tools/javap/MethodData.java	Thu May 22 09:37:57 2008 -0700
     9.2 +++ b/src/share/classes/sun/tools/javap/MethodData.java	Wed May 28 00:02:28 2008 -0700
     9.3 @@ -43,14 +43,14 @@
     9.4      int descriptor_index;
     9.5      int attributes_count;
     9.6      byte[] code;
     9.7 -    Vector exception_table = new Vector(0);
     9.8 -    Vector lin_num_tb = new Vector(0);
     9.9 -    Vector loc_var_tb = new Vector(0);
    9.10 +    Vector<TrapData> exception_table = new Vector<TrapData>(0);
    9.11 +    Vector<LineNumData> lin_num_tb = new Vector<LineNumData>(0);
    9.12 +    Vector<LocVarData> loc_var_tb = new Vector<LocVarData>(0);
    9.13      StackMapTableData[] stackMapTable;
    9.14      StackMapData[] stackMap;
    9.15      int[] exc_index_table=null;
    9.16 -    Vector attrs=new Vector(0);
    9.17 -    Vector code_attrs=new Vector(0);
    9.18 +    Vector<AttrData> attrs=new Vector<AttrData>(0);
    9.19 +    Vector<AttrData> code_attrs=new Vector<AttrData>(0);
    9.20      int max_stack,  max_locals;
    9.21      boolean isSynthetic=false;
    9.22      boolean isDeprecated=false;
    9.23 @@ -165,7 +165,7 @@
    9.24       */
    9.25      void readExceptionTable (DataInputStream in) throws IOException {
    9.26          int exception_table_len=in.readUnsignedShort();
    9.27 -        exception_table=new Vector(exception_table_len);
    9.28 +        exception_table=new Vector<TrapData>(exception_table_len);
    9.29          for (int l = 0; l < exception_table_len; l++) {
    9.30              exception_table.addElement(new TrapData(in, l));
    9.31          }
    9.32 @@ -177,7 +177,7 @@
    9.33      void readLineNumTable (DataInputStream in) throws IOException {
    9.34          int attr_len = in.readInt(); // attr_length
    9.35          int lin_num_tb_len = in.readUnsignedShort();
    9.36 -        lin_num_tb=new Vector(lin_num_tb_len);
    9.37 +        lin_num_tb=new Vector<LineNumData>(lin_num_tb_len);
    9.38          for (int l = 0; l < lin_num_tb_len; l++) {
    9.39              lin_num_tb.addElement(new LineNumData(in));
    9.40          }
    9.41 @@ -189,7 +189,7 @@
    9.42      void readLocVarTable (DataInputStream in) throws IOException {
    9.43          int attr_len=in.readInt(); // attr_length
    9.44          int loc_var_tb_len = in.readUnsignedShort();
    9.45 -        loc_var_tb = new Vector(loc_var_tb_len);
    9.46 +        loc_var_tb = new Vector<LocVarData>(loc_var_tb_len);
    9.47          for (int l = 0; l < loc_var_tb_len; l++) {
    9.48              loc_var_tb.addElement(new LocVarData(in));
    9.49          }
    9.50 @@ -237,7 +237,7 @@
    9.51       */
    9.52      public String[] getAccess(){
    9.53  
    9.54 -        Vector v = new Vector();
    9.55 +        Vector<String> v = new Vector<String>();
    9.56          if ((access & ACC_PUBLIC)   !=0) v.addElement("public");
    9.57          if ((access & ACC_PRIVATE)   !=0) v.addElement("private");
    9.58          if ((access & ACC_PROTECTED)   !=0) v.addElement("protected");
    10.1 --- a/src/share/classes/sun/tools/javap/Tables.java	Thu May 22 09:37:57 2008 -0700
    10.2 +++ b/src/share/classes/sun/tools/javap/Tables.java	Wed May 28 00:02:28 2008 -0700
    10.3 @@ -26,8 +26,6 @@
    10.4  
    10.5  package sun.tools.javap;
    10.6  
    10.7 -import java.io.IOException;
    10.8 -import java.io.InputStream;
    10.9  import java.util.Hashtable;
   10.10  import java.util.Vector;
   10.11  
   10.12 @@ -36,14 +34,14 @@
   10.13      /**
   10.14       * Define mnemocodes table.
   10.15       */
   10.16 -  static  Hashtable mnemocodes = new Hashtable(301, 0.5f);
   10.17 +  static  Hashtable<String,Integer> mnemocodes = new Hashtable<String,Integer>(301, 0.5f);
   10.18    static  String opcExtNamesTab[]=new String[128];
   10.19    static  String opcPrivExtNamesTab[]=new String[128];
   10.20    static  void defineNonPriv(int opc, String mnem) {
   10.21 -        mnemocodes.put(opcExtNamesTab[opc]=mnem, new Integer(opc_nonpriv*256+opc));
   10.22 +        mnemocodes.put(opcExtNamesTab[opc]=mnem, opc_nonpriv*256+opc);
   10.23    }
   10.24    static  void definePriv(int opc, String mnem) {
   10.25 -        mnemocodes.put(opcPrivExtNamesTab[opc]="priv_"+mnem, new Integer(opc_priv*256+opc));
   10.26 +        mnemocodes.put(opcPrivExtNamesTab[opc]="priv_"+mnem, opc_priv*256+opc);
   10.27    }
   10.28    static  void defineExt(int opc, String mnem) {
   10.29          defineNonPriv(opc, mnem);
   10.30 @@ -51,28 +49,28 @@
   10.31    }
   10.32    static { int k;
   10.33          for (k=0; k<opc_wide; k++) {
   10.34 -                mnemocodes.put(opcNamesTab[k], new Integer(k));
   10.35 +                mnemocodes.put(opcNamesTab[k], k);
   10.36          }
   10.37          for (k=opc_wide+1; k<opcNamesTab.length; k++) {
   10.38 -                mnemocodes.put(opcNamesTab[k], new Integer(k));
   10.39 +                mnemocodes.put(opcNamesTab[k], k);
   10.40          }
   10.41 -        mnemocodes.put("invokenonvirtual", new Integer(opc_invokespecial));
   10.42 +        mnemocodes.put("invokenonvirtual", opc_invokespecial);
   10.43  
   10.44 -        mnemocodes.put("iload_w", new Integer(opc_iload_w));
   10.45 -        mnemocodes.put("lload_w", new Integer(opc_lload_w));
   10.46 -        mnemocodes.put("fload_w", new Integer(opc_fload_w));
   10.47 -        mnemocodes.put("dload_w", new Integer(opc_dload_w));
   10.48 -        mnemocodes.put("aload_w", new Integer(opc_aload_w));
   10.49 -        mnemocodes.put("istore_w", new Integer(opc_istore_w));
   10.50 -        mnemocodes.put("lstore_w", new Integer(opc_lstore_w));
   10.51 -        mnemocodes.put("fstore_w", new Integer(opc_fstore_w));
   10.52 -        mnemocodes.put("dstore_w", new Integer(opc_dstore_w));
   10.53 -        mnemocodes.put("astore_w", new Integer(opc_astore_w));
   10.54 -        mnemocodes.put("ret_w", new Integer(opc_ret_w));
   10.55 -        mnemocodes.put("iinc_w", new Integer(opc_iinc_w));
   10.56 +        mnemocodes.put("iload_w", opc_iload_w);
   10.57 +        mnemocodes.put("lload_w", opc_lload_w);
   10.58 +        mnemocodes.put("fload_w", opc_fload_w);
   10.59 +        mnemocodes.put("dload_w", opc_dload_w);
   10.60 +        mnemocodes.put("aload_w", opc_aload_w);
   10.61 +        mnemocodes.put("istore_w", opc_istore_w);
   10.62 +        mnemocodes.put("lstore_w", opc_lstore_w);
   10.63 +        mnemocodes.put("fstore_w", opc_fstore_w);
   10.64 +        mnemocodes.put("dstore_w", opc_dstore_w);
   10.65 +        mnemocodes.put("astore_w", opc_astore_w);
   10.66 +        mnemocodes.put("ret_w", opc_ret_w);
   10.67 +        mnemocodes.put("iinc_w", opc_iinc_w);
   10.68  
   10.69 -        mnemocodes.put("nonpriv", new Integer(opc_nonpriv));
   10.70 -        mnemocodes.put("priv", new Integer(opc_priv));
   10.71 +        mnemocodes.put("nonpriv", opc_nonpriv);
   10.72 +        mnemocodes.put("priv", opc_priv);
   10.73  
   10.74          defineExt(0, "load_ubyte");
   10.75          defineExt(1, "load_byte");
   10.76 @@ -183,7 +181,7 @@
   10.77    }
   10.78  
   10.79    public static int opcode(String mnem) {
   10.80 -        Integer Val=(Integer)(mnemocodes.get(mnem));
   10.81 +        Integer Val=mnemocodes.get(mnem);
   10.82          if (Val == null) return -1;
   10.83          return Val.intValue();
   10.84    }
   10.85 @@ -191,7 +189,7 @@
   10.86      /**
   10.87       * Initialized keyword and token Hashtables
   10.88       */
   10.89 -  static Vector keywordNames = new Vector(40);
   10.90 +  static Vector<String> keywordNames = new Vector<String>(40);
   10.91    private static void defineKeywordName(String id, int token) {
   10.92  
   10.93          if (token>=keywordNames.size()) {
   10.94 @@ -202,7 +200,7 @@
   10.95    public static String keywordName(int token) {
   10.96          if (token==-1) return "EOF";
   10.97          if (token>=keywordNames.size()) return null;
   10.98 -        return (String)keywordNames.elementAt(token);
   10.99 +        return keywordNames.elementAt(token);
  10.100    }
  10.101    static {
  10.102          defineKeywordName("ident", IDENT);
  10.103 @@ -217,15 +215,15 @@
  10.104          defineKeywordName("RBRACE", RBRACE);
  10.105    }
  10.106  
  10.107 -  static Hashtable keywords = new Hashtable(40);
  10.108 +  static Hashtable<String,Integer> keywords = new Hashtable<String,Integer>(40);
  10.109    public static int keyword(String idValue) {
  10.110 -        Integer Val=(Integer)(keywords.get(idValue));
  10.111 -        if (Val == null) return IDENT;
  10.112 -        return Val.intValue();
  10.113 +        Integer val=keywords.get(idValue);
  10.114 +        if (val == null) return IDENT;
  10.115 +        return val.intValue();
  10.116    }
  10.117  
  10.118    private static void defineKeyword(String id, int token) {
  10.119 -        keywords.put(id, new Integer(token));
  10.120 +        keywords.put(id, token);
  10.121          defineKeywordName(id, token);
  10.122    }
  10.123    static {
  10.124 @@ -275,8 +273,8 @@
  10.125     /**
  10.126       * Define tag table.
  10.127       */
  10.128 -  private static Vector tagNames = new Vector(10);
  10.129 -  private static Hashtable Tags = new Hashtable(10);
  10.130 +  private static Vector<String> tagNames = new Vector<String>(10);
  10.131 +  private static Hashtable<String,Integer> Tags = new Hashtable<String,Integer>(10);
  10.132    static {
  10.133          defineTag("Asciz",CONSTANT_UTF8);
  10.134          defineTag("int",CONSTANT_INTEGER);
  10.135 @@ -291,7 +289,7 @@
  10.136          defineTag("NameAndType",CONSTANT_NAMEANDTYPE);
  10.137    }
  10.138    private static void defineTag(String id, int val) {
  10.139 -        Tags.put(id, new Integer(val));
  10.140 +        Tags.put(id, val);
  10.141          if (val>=tagNames.size()) {
  10.142                  tagNames.setSize(val+1);
  10.143          }
  10.144 @@ -299,10 +297,10 @@
  10.145    }
  10.146    public static String tagName(int tag) {
  10.147          if (tag>=tagNames.size()) return null;
  10.148 -        return (String)tagNames.elementAt(tag);
  10.149 +        return tagNames.elementAt(tag);
  10.150    }
  10.151    public static int tagValue(String idValue) {
  10.152 -        Integer Val=(Integer)(Tags.get(idValue));
  10.153 +        Integer Val=Tags.get(idValue);
  10.154          if (Val == null) return 0;
  10.155          return Val.intValue();
  10.156    }
  10.157 @@ -310,8 +308,8 @@
  10.158     /**
  10.159       * Define type table. These types used in "newarray" instruction only.
  10.160       */
  10.161 -  private static Vector typeNames = new Vector(10);
  10.162 -  private static Hashtable Types = new Hashtable(10);
  10.163 +  private static Vector<String> typeNames = new Vector<String>(10);
  10.164 +  private static Hashtable<String,Integer> Types = new Hashtable<String,Integer>(10);
  10.165    static {
  10.166          defineType("int",T_INT);
  10.167          defineType("long",T_LONG);
  10.168 @@ -324,28 +322,28 @@
  10.169          defineType("short",T_SHORT);
  10.170    }
  10.171    private static void defineType(String id, int val) {
  10.172 -        Types.put(id, new Integer(val));
  10.173 +        Types.put(id, val);
  10.174          if (val>=typeNames.size()) {
  10.175                  typeNames.setSize(val+1);
  10.176          }
  10.177          typeNames.setElementAt(id, val);
  10.178    }
  10.179    public static int typeValue(String idValue) {
  10.180 -        Integer Val=(Integer)(Types.get(idValue));
  10.181 +        Integer Val=Types.get(idValue);
  10.182          if (Val == null) return -1;
  10.183          return Val.intValue();
  10.184    }
  10.185    public static String typeName(int type) {
  10.186          if (type>=typeNames.size()) return null;
  10.187 -        return (String)typeNames.elementAt(type);
  10.188 +        return typeNames.elementAt(type);
  10.189    }
  10.190  
  10.191     /**
  10.192       * Define MapTypes table.
  10.193       * These constants used in stackmap tables only.
  10.194       */
  10.195 -  private static Vector mapTypeNames = new Vector(10);
  10.196 -  private static Hashtable MapTypes = new Hashtable(10);
  10.197 +  private static Vector<String> mapTypeNames = new Vector<String>(10);
  10.198 +  private static Hashtable<String,Integer> MapTypes = new Hashtable<String,Integer>(10);
  10.199    static {
  10.200          defineMapType("bogus",             ITEM_Bogus);
  10.201          defineMapType("int",               ITEM_Integer);
  10.202 @@ -358,20 +356,20 @@
  10.203          defineMapType("uninitialized",     ITEM_NewObject);
  10.204    }
  10.205    private static void defineMapType(String id, int val) {
  10.206 -        MapTypes.put(id, new Integer(val));
  10.207 +        MapTypes.put(id, val);
  10.208          if (val>=mapTypeNames.size()) {
  10.209                  mapTypeNames.setSize(val+1);
  10.210          }
  10.211          mapTypeNames.setElementAt(id, val);
  10.212    }
  10.213    public static int mapTypeValue(String idValue) {
  10.214 -        Integer Val=(Integer)(MapTypes.get(idValue));
  10.215 +        Integer Val=MapTypes.get(idValue);
  10.216          if (Val == null) return -1;
  10.217          return Val.intValue();
  10.218    }
  10.219    public static String mapTypeName(int type) {
  10.220          if (type>=mapTypeNames.size()) return null;
  10.221 -        return (String)mapTypeNames.elementAt(type);
  10.222 +        return mapTypeNames.elementAt(type);
  10.223    }
  10.224  
  10.225  }
    11.1 --- a/src/share/classes/sun/tools/javap/TypeSignature.java	Thu May 22 09:37:57 2008 -0700
    11.2 +++ b/src/share/classes/sun/tools/javap/TypeSignature.java	Wed May 28 00:02:28 2008 -0700
    11.3 @@ -79,7 +79,7 @@
    11.4       * Returns java type signature of a parameter.
    11.5       */
    11.6      public String getParametersHelper(String parameterdes){
    11.7 -        Vector parameters = new Vector();
    11.8 +        Vector<String> parameters = new Vector<String>();
    11.9          int startindex = -1;
   11.10          int endindex = -1;
   11.11          String param = "";
   11.12 @@ -187,7 +187,7 @@
   11.13          int i;
   11.14  
   11.15          for(i = 0; i < parameters.size(); i++){
   11.16 -            parametersignature += (String)parameters.elementAt(i);
   11.17 +            parametersignature += parameters.elementAt(i);
   11.18              if(i != parameters.size()-1){
   11.19                  parametersignature += ", ";
   11.20              }
    12.1 --- a/test/tools/javac/6589361/T6589361.java	Thu May 22 09:37:57 2008 -0700
    12.2 +++ b/test/tools/javac/6589361/T6589361.java	Wed May 28 00:02:28 2008 -0700
    12.3 @@ -24,7 +24,7 @@
    12.4              Iterable<JavaFileObject> files = fm.list(StandardLocation.PLATFORM_CLASS_PATH, "java.lang", set, false);
    12.5              for (JavaFileObject file : files) {
    12.6  
    12.7 -                if (file.toString().startsWith("java" + File.separator + "lang" + File.separator + "Object.class")) {
    12.8 +                if (file.toString().contains("java" + File.separator + "lang" + File.separator + "Object.class")) {
    12.9                      String str = fm.inferBinaryName(StandardLocation.CLASS_PATH, file);
   12.10                      if (!str.equals("java.lang.Object")) {
   12.11                          throw new AssertionError("Error in JavacFileManager.inferBinaryName method!");
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/test/tools/javac/T6705935.java	Wed May 28 00:02:28 2008 -0700
    13.3 @@ -0,0 +1,65 @@
    13.4 +/*
    13.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.7 + *
    13.8 + * This code is free software; you can redistribute it and/or modify it
    13.9 + * under the terms of the GNU General Public License version 2 only, as
   13.10 + * published by the Free Software Foundation.
   13.11 + *
   13.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   13.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13.15 + * version 2 for more details (a copy is included in the LICENSE file that
   13.16 + * accompanied this code).
   13.17 + *
   13.18 + * You should have received a copy of the GNU General Public License version
   13.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   13.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   13.21 + *
   13.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   13.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   13.24 + * have any questions.
   13.25 + */
   13.26 +
   13.27 +/*
   13.28 + * @test
   13.29 + * @bug 6705935
   13.30 + * @summary javac reports path name of entry in ZipFileIndex incorectly
   13.31 + */
   13.32 +
   13.33 +import java.io.*;
   13.34 +import java.util.*;
   13.35 +import javax.tools.*;
   13.36 +import com.sun.tools.javac.util.*;
   13.37 +
   13.38 +public class T6705935 {
   13.39 +    public static void main(String... args) throws Exception {
   13.40 +        new T6705935().run();
   13.41 +    }
   13.42 +
   13.43 +    public void run() throws Exception {
   13.44 +        File java_home = new File(System.getProperty("java.home"));
   13.45 +        if (java_home.getName().equals("jre"))
   13.46 +            java_home = java_home.getParentFile();
   13.47 +
   13.48 +        JavaCompiler c = ToolProvider.getSystemJavaCompiler();
   13.49 +        JavaFileManager fm = c.getStandardFileManager(null, null, null);
   13.50 +        for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH,
   13.51 +                                        "java.lang",
   13.52 +                                        Collections.singleton(JavaFileObject.Kind.CLASS),
   13.53 +                                        false)) {
   13.54 +            String p = ((BaseFileObject)fo).getPath();
   13.55 +            int bra = p.indexOf("(");
   13.56 +            int ket = p.indexOf(")");
   13.57 +            //System.err.println(bra + "," + ket + "," + p.length());
   13.58 +            if (bra == -1 || ket != p.length() -1)
   13.59 +                throw new Exception("unexpected path: " + p + "[" + bra + "," + ket + "," + p.length());
   13.60 +            String part1 = p.substring(0, bra);
   13.61 +            String part2 = p.substring(bra + 1, ket);
   13.62 +            //System.err.println("[" + part1 + "|" + part2 + "]" + " " + java_home);
   13.63 +            if (part1.equals(part2) || !part1.startsWith(java_home.getPath()))
   13.64 +                throw new Exception("bad path: " + p);
   13.65 +
   13.66 +        }
   13.67 +    }
   13.68 +}

mercurial