Open natros opened 2 months ago
Also our project suffers from the missing jakarta-inject-api dependency. It is nowwhere documented that it is a requirement with dagger 2.52 Edit: nevermind, the release notes were updated.
The maven project can be compiled, but the actual app created with jpackage fails due a java.lang.NoClassDefFoundError
. Excerpt from the jvm start:
[0.910s][info ][class,init ] Verification for org.cryptomator.launcher.DaggerCryptomatorComponent$CryptomatorComponentImpl has exception pending 'java.lang.NoClassDefFoundError jakarta/inject/Provider'
[0.910s][info ][class,init ] End class verification for: org.cryptomator.launcher.DaggerCryptomatorComponent$CryptomatorComponentImpl
[0.910s][info ][verification ] Verification for org.cryptomator.launcher.DaggerCryptomatorComponent$CryptomatorComponentImpl has exception pending 'java.lang.NoClassDefFoundError jakarta/inject/Provider'
[0.910s][info ][verification ] End class verification for: org.cryptomator.launcher.DaggerCryptomatorComponent$CryptomatorComponentImpl
[0.910s][debug][stackbarrier ] Computed disarmed for tid 8452
[0.910s][info ][exceptions ] Exception <a 'java/lang/NoClassDefFoundError'{0x00000000f4e65f98}: jakarta/inject/Provider>
thrown in interpreter method <{method} {0x000001ee5570ad20} 'create' '(J)Lorg/cryptomator/launcher/CryptomatorComponent;' in 'org/cryptomator/launcher/DaggerCryptomatorComponent$Factory'>
at bci 8 for thread 0x000001ee3e3554e0 (main)
[0.910s][debug][exceptions ] Looking for catch handler for exception of type "java.lang.NoClassDefFoundError" in method "create"
[0.910s][debug][exceptions ] No catch handler found for exception of type "java.lang.NoClassDefFoundError" in method "create"
[0.910s][debug][stackbarrier ] Computed disarmed for tid 8452
[0.910s][info ][exceptions ] Exception <a 'java/lang/NoClassDefFoundError'{0x00000000f4e65f98}: jakarta/inject/Provider>
thrown in interpreter method <{method} {0x000001ee557017d0} '<clinit>' '()V' in 'org/cryptomator/launcher/Cryptomator'>
at bci 30 for thread 0x000001ee3e3554e0 (main)
Same problem.
I added what I think are the dependencies needed for GWT, but to be honest, I really have very little experience with GWT. Can you try out the version at head and see if that fixes it? https://dagger.dev/dev-guide/versions for instructions on using the head snapshots.
The problemNo source code is available for type jakarta.inject.Provider
was fixed. It is failing with this now, it is a progress. I will try to submit a reproducible repo. Thanks. I replaced javax.inject.Inject by @jakarta.inject.Inject in few places but still failing. Notice I am using autofactory, I don't know if that could be a problem. Autofactory uses javax.*.
Before I never had issues by upgrading dagger.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project project: Compilation failure: Compilation failure:
[ERROR] xxxxx/AppComponent.java:[12,1] [Dagger/MissingBinding] jakarta.inject.Provider<com.foo.payloads.PayloadListView> cannot be provided without an @Provides-annotated method.
[ERROR]
[ERROR] jakarta.inject.Provider<com.foo.payloads.PayloadListView> is injected at
[ERROR] [com.foo.AppComponent] com.foo.payloads.PayloadListActivityFactory(viewProvider, …)
[ERROR] com.foo.payloads.PayloadListActivityFactory is injected at
[ERROR] [com.foo.AppComponent] com.foo.payloads.PayloadFactory.factory
[ERROR] com.foo.payloads.PayloadFactory is injected at
[ERROR] [com.foo.AppComponent] com.foo.MainActivityMapper.payloadFactory
[ERROR] com.foo.MainActivityMapper is requested at
[ERROR] [com.foo.AppComponent] com.foo.AppComponent.mainActivityMapper()
The content of gwt/dagger/Dagger.gwt.xml
appears to be incorrect. I believe that the correct content should be:
<module>
<inherits name="javax.inject.Inject" />
<inherits name="jakarta.inject.Inject" />
<source path=""/>
</module>
Adding manually these 2 entries I sill have same issue. just FYI
Thanks @natros, I've made that change now, so hoping it should now work at head.
@gardellajuanpablomodusbox The issue you're running into is a bit different. Right now Dagger doesn't support requesting dependencies with jakarta.inject.Provider
, you still have to use javax.inject.Provider
. This change that broke is the first step in the process for supporting that, which is making our factories extend both Provider types. So you'll have to go back to importing javax.inject.Provider
until we add support in a future release.
I actually have javax.inject.Provider. I replaced with jakarta.inject.Provider to see if that solves the issue. I will try again without these changes and will share the logs, thanks
There's another problem with the introduction of jspecify annotations in HEAD.
Tracing compile failure path for type 'dagger.internal.InstanceFactory'
[ERROR] Errors in 'jar:file:/Users/fsousa/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/HEAD-SNAPSHOT/404d74d8fbbc92a599e5c76abc9f4060468f2b9f/dagger-HEAD-SNAPSHOT-sources.jar!/dagger/internal/InstanceFactory.java'
[ERROR] Line 33: No source code is available for type org.jspecify.annotations.Nullable; did you forget to inherit a required module?
[ERROR] Errors in 'jar:file:/Users/fsousa/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/HEAD-SNAPSHOT/404d74d8fbbc92a599e5c76abc9f4060468f2b9f/dagger-HEAD-SNAPSHOT-sources.jar!/dagger/internal/Factory.java'
[ERROR] Line 35: No source code is available for type org.jspecify.annotations.Nullable; did you forget to inherit a required module?
[ERROR] Errors in 'jar:file:/Users/fsousa/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/HEAD-SNAPSHOT/404d74d8fbbc92a599e5c76abc9f4060468f2b9f/dagger-HEAD-SNAPSHOT-sources.jar!/dagger/internal/Provider.java'
[ERROR] Line 25: No source code is available for type org.jspecify.annotations.Nullable; did you forget to inherit a required module?
Tracing compile failure path for type 'dagger.internal.SingleCheck'
[ERROR] Errors in 'jar:file:/Users/fsousa/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/HEAD-SNAPSHOT/404d74d8fbbc92a599e5c76abc9f4060468f2b9f/dagger-HEAD-SNAPSHOT-sources.jar!/dagger/internal/SingleCheck.java'
[ERROR] Line 28: No source code is available for type org.jspecify.annotations.Nullable; did you forget to inherit a required module?
[ERROR] Errors in 'jar:file:/Users/fsousa/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/HEAD-SNAPSHOT/404d74d8fbbc92a599e5c76abc9f4060468f2b9f/dagger-HEAD-SNAPSHOT-sources.jar!/dagger/internal/Provider.java'
[ERROR] Line 25: No source code is available for type org.jspecify.annotations.Nullable; did you forget to inherit a required module?
Tracing compile failure path for type 'dagger.internal.DoubleCheck'
[ERROR] Errors in 'jar:file:/Users/fsousa/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/HEAD-SNAPSHOT/404d74d8fbbc92a599e5c76abc9f4060468f2b9f/dagger-HEAD-SNAPSHOT-sources.jar!/dagger/internal/DoubleCheck.java'
[ERROR] Line 29: No source code is available for type org.jspecify.annotations.Nullable; did you forget to inherit a required module?
[ERROR] Errors in 'jar:file:/Users/fsousa/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/HEAD-SNAPSHOT/404d74d8fbbc92a599e5c76abc9f4060468f2b9f/dagger-HEAD-SNAPSHOT-sources.jar!/dagger/internal/Provider.java'
[ERROR] Line 25: No source code is available for type org.jspecify.annotations.Nullable; did you forget to inherit a required module?
Tracing compile failure path for type 'dagger.internal.Factory'
[ERROR] Errors in 'jar:file:/Users/fsousa/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/HEAD-SNAPSHOT/404d74d8fbbc92a599e5c76abc9f4060468f2b9f/dagger-HEAD-SNAPSHOT-sources.jar!/dagger/internal/Factory.java'
[ERROR] Line 35: No source code is available for type org.jspecify.annotations.Nullable; did you forget to inherit a required module?
[ERROR] Errors in 'jar:file:/Users/fsousa/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/HEAD-SNAPSHOT/404d74d8fbbc92a599e5c76abc9f4060468f2b9f/dagger-HEAD-SNAPSHOT-sources.jar!/dagger/internal/Provider.java'
[ERROR] Line 25: No source code is available for type org.jspecify.annotations.Nullable; did you forget to inherit a required module?
Tracing compile failure path for type 'dagger.internal.Provider'
[ERROR] Errors in 'jar:file:/Users/fsousa/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/HEAD-SNAPSHOT/404d74d8fbbc92a599e5c76abc9f4060468f2b9f/dagger-HEAD-SNAPSHOT-sources.jar!/dagger/internal/Provider.java'
[ERROR] Line 25: No source code is available for type org.jspecify.annotations.Nullable; did you forget to inherit a required module?
[ERROR] Aborting compile due to errors in some input files
By including jspecify sources in the class path and adding the file org/jspecify/annotations/JSpecify.gwt.xml
, the initial issue appears to be resolved. However, this action results in the triggering of a new error message.
[ERROR] Unexpected internal compiler error
java.lang.ArrayIndexOutOfBoundsException: Index 25856 out of bounds for length 21
at org.objectweb.asm.ClassReader.readUtf(ClassReader.java:3682)
at org.objectweb.asm.ClassReader.readUTF8(ClassReader.java:3669)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:605)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
at com.google.gwt.dev.javac.BytecodeSignatureMaker.visitCompileDependenciesInBytecode(BytecodeSignatureMaker.java:228)
at com.google.gwt.dev.javac.BytecodeSignatureMaker.getCompileDependencySignature(BytecodeSignatureMaker.java:209)
at com.google.gwt.dev.javac.CompiledClass.getSignatureHash(CompiledClass.java:166)
at com.google.gwt.dev.javac.Dependencies$Ref.<init>(Dependencies.java:41)
at com.google.gwt.dev.javac.Dependencies$Ref.<init>(Dependencies.java:36)
at com.google.gwt.dev.javac.Dependencies.resolve(Dependencies.java:107)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:349)
at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:532)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:464)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:423)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:210)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:190)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:131)
at com.google.gwt.dev.Compiler.compile(Compiler.java:192)
at com.google.gwt.dev.Compiler.compile(Compiler.java:143)
at com.google.gwt.dev.Compiler.compile(Compiler.java:132)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:110)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
at com.google.gwt.dev.Compiler.main(Compiler.java:113)
This last error might be caused by the GWT compiler itself for not being able to handle Nullable annotations properly.
The issue on the GWT side has been fixed and it is now working for me.
Using HEAD-SNAPSHOT for GWT and Dagger still shows me the error:
[INFO] Compiling module xxx.App
[INFO] [ERROR] Unexpected internal compiler error
[INFO] java.lang.ArrayIndexOutOfBoundsException: Index 25856 out of bounds for length 21
[INFO] at org.objectweb.asm.ClassReader.readUtf(ClassReader.java:3685)
[INFO] at org.objectweb.asm.ClassReader.readUTF8(ClassReader.java:3672)
[INFO] at org.objectweb.asm.ClassReader.accept(ClassReader.java:605)
[INFO] at org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
[INFO] at com.google.gwt.dev.javac.BytecodeSignatureMaker.visitCompileDependenciesInBytecode(BytecodeSignatureMaker.java:228)
[INFO] at com.google.gwt.dev.javac.BytecodeSignatureMaker.getCompileDependencySignature(BytecodeSignatureMaker.java:209)
[INFO] at com.google.gwt.dev.javac.CompiledClass.getSignatureHash(CompiledClass.java:166)
[INFO] at com.google.gwt.dev.javac.Dependencies$Ref.<init>(Dependencies.java:41)
[INFO] at com.google.gwt.dev.javac.Dependencies$Ref.<init>(Dependencies.java:36)
[INFO] at com.google.gwt.dev.javac.Dependencies.resolve(Dependencies.java:107)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:349)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:532)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:464)
[INFO] at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:426)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:210)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:190)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:131)
[INFO] at com.google.gwt.dev.Compiler.compile(Compiler.java:192)
[INFO] at com.google.gwt.dev.Compiler.compile(Compiler.java:143)
[INFO] at com.google.gwt.dev.Compiler.compile(Compiler.java:132)
[INFO] at com.google.gwt.dev.Compiler$1.run(Compiler.java:110)
[INFO] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
[INFO] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
[INFO] at com.google.gwt.dev.Compiler.main(Compiler.java:113)
@natros did you build GWT locally?
@natros did you build GWT locally?
yes I did.
It looks like there is a new build every day at the following URL: https://oss.sonatype.org/content/repositories/snapshots/org/gwtproject/gwt-user/HEAD-SNAPSHOT/
Confirmed it works now using latest GWT's HEAD-SNAPSHOT and Dagger HEAD-SNAPSHOT.
Hi,
After updating from 2.51.1 to 2.52, my GWT application does not compile. It fails with the following error:
I think the problem might be related to the fact that 2.52 does not provide the source dependency of
jakarta.inject-api
in thecom.google.dagger:dagger-gwt:2.52
.Additionally, it may require ajakarta/inject/Inject.gwt.xml
and changes todagger/Dagger.gwt.xml
Thanks.