[
https://jira.jboss.org/jira/browse/JASSIST-102?page=com.atlassian.jira.pl...
]
Shigeru Chiba edited comment on JASSIST-102 at 12/28/09 1:32 AM:
-----------------------------------------------------------------
I'm using CtNewMethod.copy (I'm copying a method, not a constructor,
but the situation is the same). Anyway, this is documented also in
CtMethod(CtMethod,CtClass,ClassMap), but it is not documented either
in CtNewMethod.copy or in CtNewConstructor.copy. Beyond the "See also"
link, it would be useful to have a note like "this is just a
convenience method for <constructor name>, pay attention [or beware]
to its particular semantics".
Anyway, I just verified that the suggested solution works well, so no
code changes are needed, just these doc fixes. Is that OK?
--
Paolo Giarrusso
was (Author: chiba):
I'm using CtNewMethod.copy (I'm copying a method, not a constructor,
but the situation is the same). Anyway, this is documented also in
CtMethod(CtMethod,CtClass,ClassMap), but it is not documented either
in CtNewMethod.copy or in CtNewConstructor.copy. Beyond the "See also"
link, it would be useful to have a note like "this is just a
convenience method for <constructor name>, pay attention [or beware]
to its particular semantics".
Anyway, I just verified that the suggested solution works well, so no
code changes are needed, just these doc fixes. Is that OK?
Bug report for CtNewMethod.copy
-------------------------------
Key: JASSIST-102
URL:
https://jira.jboss.org/jira/browse/JASSIST-102
Project: Javassist
Issue Type: Bug
Affects Versions: 3.11.0.GA
Reporter: Shigeru Chiba
Assignee: Shigeru Chiba
Priority: Minor
** the following message was directly sent to chiba on December 26, 2009.
Dear Shigeru,
when copying a method from class A to class B, the class name of A is
replaced by B all over the descriptor of the method. This is not
documented, and is not required in all cases; I understand that the
opcodes for "this" return B instead of A, and this may justify using a
different return type (but doesn't justify using different argument
types). I use this method to build manually my proxies and to
replicate the original signature, while later replacing the method's
body.
I suggest documenting this behaviour, and adding an overload with a
boolean parameter to request or suppress this renaming.
Here's the stack trace (built manually) that shows where this happens
(I first noticed this behaviour experimentally):
MethodInfo.read(MethodInfo src, String methodname, Map classnames) (line 478)
MethodInfo(ConstPool cp, String methodname, MethodInfo src,
Map classnameMap) (line 104)
void CtBehaviour.copy(CtBehavior src, boolean isCons, ClassMap map) (line 66)
CtMethod(CtMethod src, CtClass declaring, ClassMap map) (line 113)
CtMethod CtNewMethod.copy(CtMethod src, CtClass declaring,
ClassMap map) (line 159)
Kind regards
--
Paolo Giarrusso
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira