[jboss-cvs] javassist SVN: r585 - in trunk/src/main/javassist/bytecode: analysis and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 8 05:10:34 EDT 2011


Author: chiba
Date: 2011-07-08 05:10:34 -0400 (Fri, 08 Jul 2011)
New Revision: 585

Modified:
   trunk/src/main/javassist/bytecode/ConstPool.java
   trunk/src/main/javassist/bytecode/analysis/Executor.java
Log:
fixed JASSIST-138

Modified: trunk/src/main/javassist/bytecode/ConstPool.java
===================================================================
--- trunk/src/main/javassist/bytecode/ConstPool.java	2011-07-08 08:37:50 UTC (rev 584)
+++ trunk/src/main/javassist/bytecode/ConstPool.java	2011-07-08 09:10:34 UTC (rev 585)
@@ -215,6 +215,28 @@
     }
 
     /**
+     * Reads <code>CONSTANT_Class_info</code> structure
+     * at the given index.
+     *
+     * @return  the descriptor of the type specified
+     *          by <code>name_index</code>.
+     * @see javassist.ClassPool#getCtClass(String)
+     * @since 3.15
+     */
+    public String getClassInfoByDescriptor(int index) {
+        ClassInfo c = (ClassInfo)getItem(index);
+        if (c == null)
+            return null;
+        else {
+            String className = getUtf8Info(c.name);
+            if (className.charAt(0) == '[')
+                return className;
+            else
+                return Descriptor.of(className);
+        }
+    }
+
+    /**
      * Reads the <code>name_index</code> field of the
      * <code>CONSTANT_NameAndType_info</code> structure
      * at the given index.

Modified: trunk/src/main/javassist/bytecode/analysis/Executor.java
===================================================================
--- trunk/src/main/javassist/bytecode/analysis/Executor.java	2011-07-08 08:37:50 UTC (rev 584)
+++ trunk/src/main/javassist/bytecode/analysis/Executor.java	2011-07-08 09:10:34 UTC (rev 585)
@@ -596,7 +596,7 @@
                 break;
             case CHECKCAST:
                 verifyAssignable(Type.OBJECT, simplePop(frame));
-                frame.push(typeFromDesc(constPool.getClassInfo(iter.u16bitAt(pos + 1))));
+                frame.push(typeFromDesc(constPool.getClassInfoByDescriptor(iter.u16bitAt(pos + 1))));
                 break;
             case INSTANCEOF:
                 verifyAssignable(Type.OBJECT, simplePop(frame));



More information about the jboss-cvs-commits mailing list