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

Shigeru Chiba chiba at is.titech.ac.jp
Fri Jul 4 05:17:50 EDT 2008


  User: chiba   
  Date: 08/07/04 05:17:50

  Modified:    src/main/javassist   CtClass.java ClassPool.java
  Log:
  added ClassPool.getCtClass() and fixed related bugs.
  
  Revision  Changes    Path
  1.100     +1 -1      javassist/src/main/javassist/CtClass.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CtClass.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/CtClass.java,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -b -r1.99 -r1.100
  --- CtClass.java	3 Jul 2008 07:56:24 -0000	1.99
  +++ CtClass.java	4 Jul 2008 09:17:50 -0000	1.100
  @@ -52,7 +52,7 @@
       /**
        * The version number of this release.
        */
  -    public static final String version = "3.8.0.GA";
  +    public static final String version = "3.8.1.GA";
   
       /**
        * Prints the version number and the copyright notice.
  
  
  
  1.66      +29 -1     javassist/src/main/javassist/ClassPool.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ClassPool.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/ClassPool.java,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -b -r1.65 -r1.66
  --- ClassPool.java	2 Nov 2007 17:15:01 -0000	1.65
  +++ ClassPool.java	4 Jul 2008 09:17:50 -0000	1.66
  @@ -441,6 +441,33 @@
       }
   
       /**
  +     * Returns a <code>CtClass</code> object with the given name.
  +     * This is almost equivalent to <code>get(String)</code> except
  +     * that classname can be an array-type "descriptor" (an encoded
  +     * type name) such as <code>[Ljava/lang/Object;</code>.
  +     *
  +     * <p>Using this method is not recommended; this method should be 
  +     * used only to obtain the <code>CtClass</code> object
  +     * with a name returned from <code>getClassInfo</code> in
  +     * <code>javassist.bytecode.ClassPool</code>.  <code>getClassInfo</code>
  +     * returns a fully-qualified class name but, if the class is an array
  +     * type, it returns a descriptor.
  +     *
  +     * @param classname         a fully-qualified class name or a descriptor
  +     *                          representing an array type.
  +     * @see #get(String)
  +     * @see javassist.bytecode.ConstPool#getClassInfo(int)
  +     * @see javassist.bytecode.Descriptor#toCtClass(String, ClassPool)
  +     * @since 3.8.1
  +     */
  +    public CtClass getCtClass(String classname) throws NotFoundException {
  +        if (classname.charAt(0) == '[')
  +            return Descriptor.toCtClass(classname, this);
  +        else
  +            return get(classname);
  +    }
  +
  +    /**
        * @param useCache      false if the cached CtClass must be ignored.
        * @param searchParent  false if the parent class pool is not searched.
        * @return null     if the class could not be found.
  @@ -463,8 +490,9 @@
   
           clazz = createCtClass(classname, useCache);
           if (clazz != null) {
  +            // clazz.getName() != classname if classname is "[L<name>;".
               if (useCache)
  -                cacheCtClass(classname, clazz, false);
  +                cacheCtClass(clazz.getName(), clazz, false);
   
               return clazz;
           }
  
  
  



More information about the jboss-cvs-commits mailing list