[jboss-cvs] javassist/src/main/javassist/bytecode ...

Shigeru Chiba chiba at is.titech.ac.jp
Mon Aug 13 05:06:31 EDT 2007


  User: chiba   
  Date: 07/08/13 05:06:31

  Modified:    src/main/javassist/bytecode   LocalVariableAttribute.java
                        ClassFile.java
  Log:
  the default major version of newly-created class files is either JDK 1.3 or 1.5, which depends on the VM version.
  
  Revision  Changes    Path
  1.11      +5 -2      javassist/src/main/javassist/bytecode/LocalVariableAttribute.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LocalVariableAttribute.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/bytecode/LocalVariableAttribute.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- LocalVariableAttribute.java	4 Jun 2007 03:11:09 -0000	1.10
  +++ LocalVariableAttribute.java	13 Aug 2007 09:06:31 -0000	1.11
  @@ -260,8 +260,11 @@
   
               ByteArray.write16bit(name, dest, j + 4);
   
  -            if (type != 0)
  -                type = cp.copy(type, newCp, null);
  +            if (type != 0)  {
  +                String sig = cp.getUtf8Info(type);
  +                sig = Descriptor.rename(sig, classnames);
  +                type = newCp.addUtf8Info(sig);
  +            }
   
               ByteArray.write16bit(type, dest, j + 6);
               ByteArray.write16bit(index, dest, j + 8);
  
  
  
  1.37      +11 -2     javassist/src/main/javassist/bytecode/ClassFile.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ClassFile.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/bytecode/ClassFile.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -b -r1.36 -r1.37
  --- ClassFile.java	12 Jun 2007 13:30:14 -0000	1.36
  +++ ClassFile.java	13 Aug 2007 09:06:31 -0000	1.37
  @@ -65,9 +65,18 @@
   
       /**
        * The major version number of class files created
  -     * from scratch.  The value is 47 (JDK 1.3).
  +     * from scratch.  The default value is 47 (JDK 1.3)
  +     * or 49 (JDK 1.5) if the JVM supports <code>java.lang.StringBuilder</code>.
        */
  -    public static final int MAJOR_VERSION = JAVA_3;
  +    public static int MAJOR_VERSION = JAVA_3;
  +
  +    static {
  +        try {
  +            Class.forName("java.lang.StringBuilder");
  +            MAJOR_VERSION = JAVA_5;
  +        }
  +        catch (Throwable t) {}
  +    }
   
       /**
        * Constructs a class file from a byte stream.
  
  
  



More information about the jboss-cvs-commits mailing list