Bugs item #987038, was opened at 2004-07-08 14:06
Message generated for change (Comment added) made by chiba
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=987038&group_id=22866
Category: Javassist
Group: CVS HEAD
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: Brett Randall (brett_s_r)
Assigned to: Shigeru Chiba (chiba)
Summary: CtNewMethod.setter causes VerifyError on static fields
Initial Comment:
Calling CtNewMethod.setter to generate a new setter
method, on a CtField that is static (Modifier.STATIC)
results in a modified class that will throw a
java.lang.VerifyError:
java.lang.VerifyError: (class: HasStaticFieldGetterSetter,
method: setBroken signature: (Z)V) Register 0 contains
wrong type
at java.lang.Class.getDeclaredConstructors0
(Native Method)
at
java.lang.Class.privateGetDeclaredConstructors
(Class.java:1610)
at java.lang.Class.getConstructor0
(Class.java:1922)
at java.lang.Class.newInstance0
(Class.java:278)
at java.lang.Class.newInstance(Class.java:261)
at
javassist.CtNewMethodGetterSetterTest.testStaticFieldG
etterSetter(CtNewMethodGetterSetterTest.java:73)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke
(Method.java:324)
at junit.framework.TestCase.runTest
(TestCase.java:154)
at junit.framework.TestCase.runBare
(TestCase.java:127)
at junit.framework.TestResult$1.protect
(TestResult.java:106)
at junit.framework.TestResult.runProtected
(TestResult.java:124)
at junit.framework.TestResult.run
(TestResult.java:109)
at junit.framework.TestCase.run
(TestCase.java:118)
at junit.framework.TestSuite.runTest
(TestSuite.java:208)
at junit.framework.TestSuite.run
(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
Tests(RemoteTestRunner.java:421)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:305)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.mai
n(RemoteTestRunner.java:186)
The problem is specific to static fields. jUnit TestCase
with one failing test attached.
----------------------------------------------------------------------
>Comment By: Shigeru Chiba (chiba)
Date: 2004-07-08 21:27
Message:
Logged In: YES
user_id=388745
Thanks, the patch has been merged into CVS HEAD.
----------------------------------------------------------------------
Comment By: Brett Randall (brett_s_r)
Date: 2004-07-08 14:39
Message:
Logged In: YES
user_id=561698
I can't see my patch attachment uploaded, so here it is
anyway:
Index: CtNewMethod.java
==============================================
=====================
RCS
file: /cvsroot/jboss/javassist/src/main/javassist/CtNewMethod.
java,v
retrieving revision 1.8
diff -u -r1.8 CtNewMethod.java
--- CtNewMethod.java 18 May 2004 08:43:47 -0000
1.8
+++ CtNewMethod.java 8 Jul 2004 05:35:56 -0000
@@ -269,7 +269,7 @@
code.addPutfield(Bytecode.THIS, fieldName,
fieldType);
}
else {
- code.addLoad(0, field.getType());
+ code.addLoad(1, field.getType());
code.addPutstatic(Bytecode.THIS, fieldName,
fieldType);
}
----------------------------------------------------------------------
Comment By: Brett Randall (brett_s_r)
Date: 2004-07-08 14:37
Message:
Logged In: YES
user_id=561698
Patch submitted.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=987038&group_id=22866
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development