Missing dependency error not displaying
If I declare an @Inject without a matching @Singleton or similar, I get the following error:
Caused by: java.lang.NullPointerException: Cannot invoke "String.lastIndexOf(int)" because "fullType" is null
It was pretty hard to realize from that what was missing. Would be good if this error was caught to provide a better message so we can see what to do.
Thanks!
Got an example class so I can replicate? The missing dependency message is usually quite descriptive, so this feels like something else is the problem.
Yeah, the error message still works for me.
[ERROR] /M:/Dev/avaje-helidon-nima-api-example/src/main/java/com/jojo/helidon/api/Example.java:[6,8] No dependency provided for com.jojo.helidon.api.DependencyClass on com.jojo.helidon.api.Example
[ERROR] Dependencies [com.jojo.helidon.api.DependencyClass] are not provided - there are no @Singleton, @Component, @Factory/@Bean that currently provide this type. If this is an external dependency consider specifying via @External
Tried field/constructor/method injection, but I am unable to replicate your issue.
@re-thc got anything to add? I can't publish a fix if I can't replicate the issue.
Happy to close. It triggers if the class is coming from another project/module/jar and no longer exists. Maybe too convoluted to cater for.
can you run with mvn compile -X and send the stacktrace.
@re-thc can you explain exactly how you got this? Edge case it may be, but if it happened once it'll happen again to somebody else.
It triggers if the class is coming from another project/module/jar and no longer exists.
what do you mean no longer exists?
can you explain exactly how you got this?
It happens if you reference a class that no longer exists. You do get class not found exceptions also. When there's a long chain of errors it's possible to miss it so was originally confused by this particular error.
what do you mean no longer exists?
Say it gets deleted or renamed.
Really need the stack trace for this one. Can you provide it?
@re-thc we should be able to fix it if you provide a stack trace
@rbygrave, I figured out how to replicate it using JPMS. All you have to do is remove requires directives for the types you're using. (like blackbox.other in the tests)