Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when base interface has methods with default implementations #84

Closed
sergey-ostapenko opened this issue Sep 22, 2015 · 1 comment
Closed

Comments

@sergey-ostapenko
Copy link

Hi.
When I trying to perform mapping in following test:

public interface BaseA {

 default String getId() {
 return "test";
 }

 default void setId(String val) {
 }
}

public class A implements BaseA {
}

public class B {
 @Getter
 @Setter
 String id;
}

@Test
public void defaultInterfaceImplementationsTest() {
 val mapperFactory = new DefaultMapperFactory.Builder().build();

 mapperFactory.classMap(A.class, B.class)
 .byDefault()
 .register();

 A a = new A();
 B b = new B();

 mapperFactory.getMapperFacade().map(a, b);
 assertThat(b, notNullValue());
}

I'm getting strange compilation error:
Caused by: compile error: getId() not found in test.unit.views.BaseViewTest$A at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:723) at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:688) at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:157)

I tried to compile generated class by hands, and all seems to be ok...
This test looks a little bit synthetic, but real situation is exactly the same.
Any ideas on how I this error can be fixed?

UPD maybe JavassistCompilerStrategy don't support java 1.8 by default ?

@sergey-ostapenko
Copy link
Author

Issue was really connected with old version of javassist dependency used in project. Latest 3.20.0-GA version solved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant