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

After updating from 2.51.1 to 2.52, my GWT application does not compile #4391

Open
natros opened this issue Aug 13, 2024 · 14 comments
Open

After updating from 2.51.1 to 2.52, my GWT application does not compile #4391

natros opened this issue Aug 13, 2024 · 14 comments

Comments

@natros
Copy link

natros commented Aug 13, 2024

Hi,

After updating from 2.51.1 to 2.52, my GWT application does not compile. It fails with the following error:

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/2.52/12ad96b4d53d511ac21cc2c19d77aa76dd388691/dagger-2.52-sources.jar!/dagger/internal/Provider.java'
         [ERROR] Line 23: No source code is available for type jakarta.inject.Provider<T>; did you forget to inherit a required module?

I think the problem might be related to the fact that 2.52 does not provide the source dependency of jakarta.inject-api in the com.google.dagger:dagger-gwt:2.52.Additionally, it may require a jakarta/inject/Inject.gwt.xml and changes to dagger/Dagger.gwt.xml

Thanks.

copybara-service bot pushed a commit that referenced this issue Aug 19, 2024
Issue #4391

RELNOTES=Add GWT dependencies for Jakarta Inject
PiperOrigin-RevId: 663855951
copybara-service bot pushed a commit that referenced this issue Aug 19, 2024
Issue #4391

RELNOTES=Add GWT dependencies for Jakarta Inject
PiperOrigin-RevId: 663855951
copybara-service bot pushed a commit that referenced this issue Aug 19, 2024
Issue #4391

RELNOTES=Add GWT dependencies for Jakarta Inject
PiperOrigin-RevId: 665040399
@infeo
Copy link

infeo commented Aug 26, 2024

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)

@gardellajuanpablomodusbox

Same problem.

@Chang-Eric
Copy link
Member

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.

@gardellajuanpablomodusbox
Copy link

gardellajuanpablomodusbox commented Sep 5, 2024

The problem No 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()

@natros
Copy link
Author

natros commented Sep 5, 2024

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>

@gardellajuanpablomodusbox

Adding manually these 2 entries I sill have same issue. just FYI

copybara-service bot pushed a commit that referenced this issue Sep 5, 2024
Issue #4391

RELNOTES=Fix gwt issue #4391
PiperOrigin-RevId: 671431210
copybara-service bot pushed a commit that referenced this issue Sep 5, 2024
Issue #4391

RELNOTES=Fix gwt issue #4391
PiperOrigin-RevId: 671441590
@Chang-Eric
Copy link
Member

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.

@gardellajuanpablomodusbox

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

@natros
Copy link
Author

natros commented Sep 5, 2024

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.

copybara-service bot pushed a commit that referenced this issue Sep 6, 2024
…o 1.0.0

Issue #4391.

RELNOTES=n/a
PiperOrigin-RevId: 671841611
copybara-service bot pushed a commit that referenced this issue Sep 6, 2024
…o 1.0.0

Issue #4391.

RELNOTES=n/a
PiperOrigin-RevId: 671841611
copybara-service bot pushed a commit that referenced this issue Sep 6, 2024
…o 1.0.0

Issue #4391.

RELNOTES=n/a
PiperOrigin-RevId: 671841611
copybara-service bot pushed a commit that referenced this issue Sep 6, 2024
…o 1.0.0

Issue #4391.

RELNOTES=n/a
PiperOrigin-RevId: 671909308
@natros
Copy link
Author

natros commented Sep 12, 2024

The issue on the GWT side has been fixed and it is now working for me.

@gardellajuanpablomodusbox

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)

@gardellajuanpablomodusbox

@natros did you build GWT locally?

@natros
Copy link
Author

natros commented Sep 12, 2024

@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/

@gardellajuanpablomodusbox
Copy link

gardellajuanpablomodusbox commented Sep 13, 2024

Confirmed it works now using latest GWT's HEAD-SNAPSHOT and Dagger HEAD-SNAPSHOT.

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

5 participants
@natros @infeo @Chang-Eric @gardellajuanpablomodusbox and others