[jboss-jira] [JBoss JIRA] (JASSIST-39) failure to compile an instance method which invokes a static method in a different class and both methods have the same return type, name and argument types
Shigeru Chiba (JIRA)
jira-events at lists.jboss.org
Mon Dec 24 21:10:08 EST 2012
[ https://issues.jboss.org/browse/JASSIST-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shigeru Chiba closed JASSIST-39.
--------------------------------
> failure to compile an instance method which invokes a static method in a different class and both methods have the same return type, name and argument types
> ------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: JASSIST-39
> URL: https://issues.jboss.org/browse/JASSIST-39
> Project: Javassist
> Issue Type: Bug
> Reporter: twieger
> Assignee: Shigeru Chiba
> Fix For: 3.13.0.GA
>
>
> The testcase below demonstrates the problem.
> The first invocation of CtNewMethod#make works, the second one fails.
> It looks like the problem is related with MemberResolver#lookupMethod.
> The check to enable the creation of a recursively called method is not precise enough. It actually succeeds, although the current method is an instance method, and the method which shall be invoked is a static method.
> ==========================================
> package experimental;
> import javassist.CannotCompileException;
> import javassist.ClassPool;
> import javassist.CtClass;
> import javassist.CtNewMethod;
> import org.testng.annotations.Test;
> public class TestJavaAssist {
> @Test
> public void testJavaAssist() throws CannotCompileException {
> ClassPool classPool = new ClassPool();
> classPool.appendSystemPath();
>
> CtClass ctClass = classPool.makeClass("Test");
> CtNewMethod.make("public String foox(){return experimental.TestJavaAssist.foo();}", ctClass);
> CtNewMethod.make("public String foo(){return experimental.TestJavaAssist.foo();}", ctClass);
> }
> public static final String foo() {
> return "foo";
> }
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list