[jboss-jira] [JBoss JIRA] (JASSIST-246) CannotCompileException thrown when invoking

Robson Enke (JIRA) issues at jboss.org
Thu May 7 16:33:46 EDT 2015


     [ https://issues.jboss.org/browse/JASSIST-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robson Enke updated JASSIST-246:
--------------------------------
    Steps to Reproduce: 
# Create an interface with one default and one abstract method
# Create a new {{CtClass}} through {{ClassPool.makeClass()}}
# Add the the interface to the {{CtClass}}
# Add an implementation to the abstract method invoking the default method in its body

  was:
# Create an interface with one default and one abstract method
# Create a new {{CtClass}} through {{ClassPool.makeClass()}}
# Add the the interface to the {{CtClass}}
# Add an implementation to the abstract method invoking the default method



> CannotCompileException thrown when invoking 
> --------------------------------------------
>
>                 Key: JASSIST-246
>                 URL: https://issues.jboss.org/browse/JASSIST-246
>             Project: Javassist
>          Issue Type: Bug
>    Affects Versions: 3.19.0-GA
>            Reporter: Robson Enke
>            Assignee: Shigeru Chiba
>            Priority: Critical
>
> Given the example below:
> {code:title=Test.java|borderStyle=solid}
> public interface Test {
> 	default void defaultMethod() {
> 	}
> 	void test();
> }
> {code}
> {code:borderStyle=solid}
> ClassPool pool = ClassPool.getDefault();
> CtClass ctClass = pool.makeClass("TestImp");
> ctClass.addInterface(pool.get(Test.class.getName()));
> String methodBody = "public void test() { defaultMethod(); }";
> CtMethod ctMethod = CtMethod.make(methodBody, ctClass);
> ctClass.addMethod(ctMethod);
> {code}
> A CannotCompileException will be thrown when creating the method, with the following message:
> {{compile error: defaultMethod() not found in TestImp}}
> This is similar to JASSIST-238 but still occurs on 3.19.0-GA



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the jboss-jira mailing list