[jboss-jira] [JBoss JIRA] Commented: (JASSIST-43) ConstPool.getItem(int) returns unexpected item, causes exceptions in calling methods; e.g. in getFieldrefClassName(...) and getInterfaceMethodrefClassName(...)
Shigeru Chiba (JIRA)
jira-events at lists.jboss.org
Thu Feb 21 08:44:45 EST 2008
[ http://jira.jboss.com/jira/browse/JASSIST-43?page=comments#action_12400166 ]
Shigeru Chiba commented on JASSIST-43:
--------------------------------------
Oh, I was confused. I thought you did not use replace().
Anyway, I guess the internal cursor, which should be automatically adusted,
points to a wrong byte for some reason.
Could you post the class file you are changing by ExprEditor?
I would also like to know how you change it.
Thank you!
> 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
More information about the jboss-jira
mailing list