[jboss-jira] [JBoss JIRA] Created: (JASSIST-138) CHECKCAST of javassist.bytecode.analysis.Executor.execute() is broken

Yu Kobayashi (JIRA) jira-events at lists.jboss.org
Thu Jan 27 03:42:49 EST 2011


CHECKCAST of javassist.bytecode.analysis.Executor.execute() is broken
---------------------------------------------------------------------

                 Key: JASSIST-138
                 URL: https://issues.jboss.org/browse/JASSIST-138
             Project: Javassist
          Issue Type: Bug
    Affects Versions: 3.12.0.GA
            Reporter: Yu Kobayashi
            Assignee: Shigeru Chiba


At execute(MethodInfo method, int pos, CodeIterator iter, Frame frame, Subroutine subroutine) of
javassist.bytecode.analysis.Executor, CHECKCAST is this.

case CHECKCAST:
    verifyAssignable(Type.OBJECT, simplePop(frame));
    frame.push(typeFromDesc(constPool.getClassInfo(iter.u16bitAt(pos + 1))));
    break;

However, constPool.getClassInfo() doesn't returns its descriptor.

To fix this, please change it to 
frame.push(typeFromDesc(constPool.getClassInfoByDescriptor(iter.u16bitAt(pos + 1))));

and add this to javassist.bytecode.ConstPool.

    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);
            }
        }
    }



-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list