This content has been marked as final.
Show 2 replies
-
1. Re: Copy-Method
sirrurg Feb 19, 2005 7:43 AM (in response to sirrurg)Hmm ... i should be more precise with this "question".
Here is the code fragment of the class i am instrumenting.public void putNewEntry(Object key, SimpleEntry entry) throws AlreadyContainedException{ .... }
This method simply inserts an new key-value pair into an Hashtable of
my class. If the key-value pair is already in the hashtable i throw an
exception. Its probably important that the second parameter is an interface. This interface also inherits from serializable, so that this
types of objects can be stored.
Now i am simply copying this method with the help of Javassist and
rename it like this:..... public void copyMethod(CtClass clazz, CtMethod method){ String mname = method.getName(); String nname = mname + ComponentInstrumentor.mAPPENDIX; method.setName(nname); CtMethod mnew = CtNewMethod.copy(method, mname, clazz, null); clazz.addMethod(mnew); } ....
Anyone a clue why i am getting such an error:java.lang.VerifyError: class ... copyMethod signature: (Ljava/lang/Object;LsimpleDB/SimpleEntry;)V (inconsitent stack height 0 != 2
-
2. Re: Copy-Method
sirrurg Feb 20, 2005 8:32 AM (in response to sirrurg)Ok ... wrong question or better the Exception is caused by sth else
than then a wrong copy operation.
I am also redirecting internal method calls and there somehow
is an error. So best remove this post ... thanx