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
NPE while building, no error message to show why #75
Comments
Are there any compilation errors higher up? I think this might happen if you are trying to inject a type that does not exist (i.e., a missing class), but I'm also not exactly sure. The code problem is here where the dependency request's type is attempted to be converted to an element. This ends up returning |
Debugging the annotation processor, it seems that I have this missing from my component:
Adding that made the build progress and now I'm getting this:
|
It looks like the code generation for the component doesn't know how to call the method when it returns an array. I suppose |
Cool. Keep 'em coming. Proper error messages will be a big focus before a
|
Yeah - that's definitely a bug in how we generate. :( On Tue Nov 18 2014 at 10:11:02 AM Jake Wharton notifications@github.com
|
Ok - can this be reproduced on the current snapshots? We've done a lot of re-writing in this code-path, so I'm going to close this for now, but if you can reproduce this with current snapshots, please re-open, ideally with a repro case. |
I'm trying to migrate my project from dagger to dagger-2.0 ('com.google.dagger:dagger-compiler:2.0' from jcenter), but build failed. Caused by: java.lang.IllegalArgumentException: com.github.baoti.git.GitSource[] does not represent a d eclared type at dagger.shaded.auto.common.MoreTypes$CastingTypeVisitor.defaultAction(MoreTypes.java:770) at dagger.shaded.auto.common.MoreTypes$CastingTypeVisitor.defaultAction(MoreTypes.java:768) at com.sun.tools.javac.code.Type$ArrayType.accept(Type.java:1117) at dagger.shaded.auto.common.MoreTypes.asDeclared(MoreTypes.java:524) at dagger.internal.codegen.MethodSignatureFormatter.nameOfType(MethodSignatureFormatter.java:1 09) at dagger.internal.codegen.MethodSignatureFormatter.format(MethodSignatureFormatter.java:77) at dagger.internal.codegen.MethodSignatureFormatter.format(MethodSignatureFormatter.java:49) at dagger.internal.codegen.BindingGraphValidator.validateComponentScope(BindingGraphValidator. java:541) at dagger.internal.codegen.BindingGraphValidator.validate(BindingGraphValidator.java:118) at dagger.internal.codegen.BindingGraphValidator.validate(BindingGraphValidator.java:111) at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:77) at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:22 8) at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvi ronment.java:794) at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessi ngEnvironment.java:705) at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnviro nment.java:91) at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironm ent.java:1035) at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvir onment.java:1176) at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856) at com.sun.tools.javac.main.Main.compile(Main.java:523) ... 66 more |
@baoti Looking at the referenced code from the stacktrace (BindingGraphValidator.java:541 and MethodSignatureFormatter.java:77) it seems like you have a method in either your component or module that returns an array of Indeed your error is shadowed by one thrown when trying to build the error message, because of the array type, which is the same error as in the 3rd comment above @cgruber This does not seem to have been fixed: dagger/compiler/src/main/java/dagger/internal/codegen/MethodSignatureFormatter.java Lines 106 to 114 in 2ffaabe
Since 2.0 there's a new special case for void but it'll still fail for arrays I believe.
|
@tbroyer Thanks for your nice explaining! |
But I doesn't understand why is |
@baoti It's |
👍 |
I'll bump this up. We're hoping for a 2.0.1 nearly immediately, but this seems worth fixing and getting in to that. |
I just had this error message with Dagger 2.0.1:
The problem was that I didn't write a If the Type is
|
I'm experimenting with the latest snapshot of Dagger 2 and I'm getting this error while building:
[snip]
I'm sure I have a missing binding, but surely would appreciate Dagger telling me which one. :)
The text was updated successfully, but these errors were encountered: