[
https://issues.jboss.org/browse/JASSIST-152?page=com.atlassian.jira.plugi...
]
Yanic Inghelbrecht commented on JASSIST-152:
--------------------------------------------
I've traced the failure to class javassist.bytecode.stackmap.TypeData, in particular
the nested class ArrayElement.
That class has a method getName :
public String getName() throws BadBytecode {
String name = array.getName();
if (name.length() > 1 && name.charAt(0) == '[') {
char c = name.charAt(1);
if (c == 'L')
return name.substring(2, name.length() - 1).replace('/',
'.');
else if (c == '[')
return name.substring(1);
}
throw new BadBytecode("bad array type for AALOAD: "
+ name);
}
In this test case the local variable 'name' is null.
However, the expectedName is not null. I was able to circumvent the issue by changing the
initialisation of that local variable from
String name = array.getName();
to
String name = array.getExpectedName();
I don't really understand the intricacies of the stackmap building code, so that is
probably not the right fix for this issue.
Best regards,
Yanic
instrumentation fails when building stackmap for local var of array
type : bad array type for AALOAD: null
----------------------------------------------------------------------------------------------------------
Key: JASSIST-152
URL:
https://issues.jboss.org/browse/JASSIST-152
Project: Javassist
Issue Type: Bug
Affects Versions: 3.15.0-GA
Environment: Any
Reporter: Yanic Inghelbrecht
Assignee: Shigeru Chiba
Attachments: demonstration.zip
When trying to instrument the attached org.hibernate.cfg.AbstractPropertyHolder (copied
from the hibernate 4.0.1 final distribution), instrumentation fails with the following
exception :
java.lang.RuntimeException: fatal error:
at javassist.bytecode.stackmap.TypeData$TypeName.getTypeData(TypeData.java:177)
at javassist.bytecode.stackmap.MapMaker.fillStackMap(MapMaker.java:410)
at javassist.bytecode.stackmap.MapMaker.toStackMapBody(MapMaker.java:393)
at javassist.bytecode.stackmap.MapMaker.toStackMap(MapMaker.java:323)
at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:98)
at javassist.bytecode.MethodInfo.rebuildStackMap(MethodInfo.java:417)
at javassist.bytecode.MethodInfo.rebuildStackMapIf6(MethodInfo.java:399)
at javassist.expr.ExprEditor.doit(ExprEditor.java:113)
at javassist.CtBehavior.instrument(CtBehavior.java:672)
at test_abstractpropertyholder.SimpleTranslator.modify(SimpleTranslator.java:25)
at test_abstractpropertyholder.SimpleTranslator.onLoad(SimpleTranslator.java:19)
at
test_abstractpropertyholder.JavassistInstrumenter.getInstrumentedClass(JavassistInstrumenter.java:21)
at test_abstractpropertyholder.Main.main(Main.java:32)transforming
org.hibernate.cfg.AbstractPropertyHolder
Caused by: javassist.bytecode.BadBytecode: bad array type for AALOAD: null
at javassist.bytecode.stackmap.TypeData$ArrayElement.getName(TypeData.java:422)
at javassist.bytecode.stackmap.TypeData$TypeName.getExpected(TypeData.java:292)
at javassist.bytecode.stackmap.TypeData$TypeName.getTypeData(TypeData.java:175)
... 12 more
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira