[
http://jira.jboss.com/jira/browse/JASSIST-43?page=comments#action_12400164 ]
Martin Burger commented on JASSIST-43:
--------------------------------------
I am following the instructions in the fourth chapter "Introspection and
customization" of the Javassist Tutorial.
Basically, I have subclasses of ExprEditor that implement one of the various edit(...)
methods declared in ExprEditor. In my edit(...) methods I use the method replace(String
statement) in order to manipulate the byte code.
In the tutorial, I cannot find something about adjusting the cursor. Did I miss something?
How can / should I adjust the cursor?
ConstPool.getItem(int) returns unexpected item, causes exceptions in
calling methods; e.g. in getFieldrefClassName(...) and
getInterfaceMethodrefClassName(...)
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: JASSIST-43
URL:
http://jira.jboss.com/jira/browse/JASSIST-43
Project: Javassist
Issue Type: Bug
Environment: $ uname -a
Darwin [...] 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007;
root:xnu-792.25.20~1/RELEASE_I386 i386 i386
$ java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241)
Java HotSpot(TM) Client VM (build 1.5.0_13-121, mixed mode, sharing)
Javassist 3.6.0
Reporter: Martin Burger
Assigned To: Shigeru Chiba
I am using subclasses of javassist.expr.ExprEditor to heavily instrument classes. On some
large (in terms of amount of code) classes I get various exceptions in ConstPool, for
example:
Caused by: java.lang.ClassCastException: javassist.bytecode.ClassInfo
at javassist.bytecode.ConstPool.getFieldrefClassName(ConstPool.java:254)
at javassist.expr.FieldAccess.getClassName(FieldAccess.java:97)
at javassist.expr.FieldAccess.getCtClass(FieldAccess.java:89)
at javassist.expr.FieldAccess.getField(FieldAccess.java:112)
And:
Caused by: java.lang.NullPointerException
at
javassist.bytecode.ConstPool.getInterfaceMethodrefClassName(ConstPool.java:413)
at javassist.expr.MethodCall.getClassName(MethodCall.java:91)
at javassist.expr.MethodCall.getCtClass(MethodCall.java:75)
at javassist.expr.MethodCall.getMethod(MethodCall.java:114)
It seems that ConstPool.getItem(int) returns an "unexpected" item, so (1) the
cast to FieldrefInfo fails and (2) the returned item is null instead of an instance of
InterfaceMethodrefInfo, respectively.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira