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

NullPointerException if mapper interface has Generic types #63

Closed
scienty opened this issue Aug 27, 2015 · 3 comments
Closed

NullPointerException if mapper interface has Generic types #63

scienty opened this issue Aug 27, 2015 · 3 comments
Labels
Milestone

Comments

@scienty
Copy link

@scienty scienty commented Aug 27, 2015

@Mapper
public interface IMapper<A, B> {
  public B atob(B bobj);
}

I found this issues on 0.12 version with gradle but I think it is related to the build tool.

Caused by: java.lang.NullPointerException
at fr.xebia.extras.selma.codegen.AnnotationWrapper.buildFor(AnnotationWrapper.java:56)
at fr.xebia.extras.selma.codegen.MapperWrapper.(MapperWrapper.java:65)
at fr.xebia.extras.selma.codegen.MapperClassGenerator.(MapperClassGenerator.java:56)
at fr.xebia.extras.selma.codegen.MapperProcessor.generateMappingClassses(MapperProcessor.java:87)
at fr.xebia.extras.selma.codegen.MapperProcessor.process(MapperProcessor.java:73)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
at com.sun.tools.javac.main.Main.compile(Main.java:439)

@scienty
Copy link
Author

@scienty scienty commented Aug 27, 2015

There is another case where super interface has Generic type and child interface has @Mapper, compilation fails too

e.g

public interface IMapper<A, B> {
public B atob(A aobj, B bobj);
}

@Mapper
public interface MyClassMapper<MyAClass, MyBClass> {
}

error:
error: In type : A and Out type : B differs and this kind of conversion is not supported here
error: In type : B and Out type : A differs and this kind of conversion is not supported here
error: Failed to generate mapping method for type A to B not supported on com.test.IMapper.atob(A,B) !

Can we not reduce the generics first and then generate code?

slemesle added a commit that referenced this issue Dec 6, 2015
@slemesle
Copy link
Collaborator

@slemesle slemesle commented Dec 6, 2015

This should now be fixed for both error cases.

@slemesle slemesle closed this Dec 6, 2015
@slemesle slemesle added this to the 0.14 milestone Dec 6, 2015
@slemesle slemesle added the enhancement label Dec 6, 2015
@anoop44
Copy link

@anoop44 anoop44 commented May 17, 2016

Anyone got this working? I am still getting NullPointer exception on v0.14

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.