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

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


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

Robson Enke updated JASSIST-246:
--------------------------------
    Description: 
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

  was:
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 occuring on 3.19.0-GA



> 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