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

An internal compiler exception occurred - Error constructing Java AST #9447

Closed
Martin-Luft opened this issue Oct 19, 2016 · 4 comments
Closed

Comments

@Martin-Luft
Copy link

I updated from GWT 2.7.0 to 2.8.0 and GWT Maven plugin from 2.7.0 to 2.8.0-rc3 and got this error:

[INFO] [ERROR] An internal compiler exception occurred
[INFO] com.google.gwt.dev.jjs.InternalCompilerException: Error constructing Java AST
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.translateException(GwtAstBuilder.java:3944)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.endVisit(GwtAstBuilder.java:1567)
[INFO]  at org.eclipse.jdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:1018)
[INFO]  at org.eclipse.jdt.internal.compiler.ast.FieldDeclaration.traverse(FieldDeclaration.java:339)
[INFO]  at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1481)
[INFO]  at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1363)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.processImpl(GwtAstBuilder.java:3887)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.process(GwtAstBuilder.java:3918)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$UnitProcessorImpl.process(CompilationStateBuilder.java:129)
[INFO]  at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.process(JdtCompiler.java:384)
[INFO]  at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:470)
[INFO]  at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:1092)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:325)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:548)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:479)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:465)
[INFO]  at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:423)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:222)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:202)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:143)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:204)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:155)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:144)
[INFO]  at com.google.gwt.dev.Compiler$1.run(Compiler.java:118)
[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:125)
[INFO] Caused by: java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.ast.MessageSend.binding()Lorg/eclipse/jdt/internal/compiler/lookup/MethodBinding;
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.isUncheckedGenericMethodCall(GwtAstBuilder.java:4167)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.access$1400(GwtAstBuilder.java:249)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.endVisit(GwtAstBuilder.java:1560)
[INFO]  ... 25 more
[INFO]    [ERROR] at NativeVerticalScrollbar.java(90): GWT.create(UiBinderBundle.class)
[INFO]       org.eclipse.jdt.internal.compiler.ast.MessageSend

Sometimes the last error changes:

[INFO]    [ERROR] at EditTextCell.java(160): GWT.create(Template.class)
[INFO]       org.eclipse.jdt.internal.compiler.ast.MessageSend

Plugin configuration:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>gwt-maven-plugin</artifactId>
  <version>2.8.0-rc3</version>
  <configuration>
    <deploy>${project.build.directory}/deploy</deploy>
    <extraJvmArgs>-Xmx1024m</extraJvmArgs>
    <failOnError>true</failOnError>
    <localWorkers>4</localWorkers>
    <module>${project.groupId}.xxx.xxx</module>
    <optimizationLevel>9</optimizationLevel>
    <style>OBFUSCATED</style>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Dependencies:

<dependencies>
  <dependency>
    <groupId>com.google.dagger</groupId>
    <artifactId>dagger</artifactId>
    <version>2.7</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>com.google.dagger</groupId>
    <artifactId>dagger-compiler</artifactId>
    <version>2.7</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>com.google.dagger</groupId>
    <artifactId>dagger-gwt</artifactId>
    <version>2.7</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>com.google.gwt</groupId>
    <artifactId>gwt-user</artifactId>
    <version>2.8.0</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>com.google.gwt.eventbinder</groupId>
    <artifactId>eventbinder</artifactId>
    <version>1.1.0</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>javax.inject</groupId>
    <artifactId>javax.inject</artifactId>
    <scope>provided</scope>
    <version>1</version>
  </dependency>
  <dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>javax.ws.rs-api</artifactId>
    <version>2.0.1</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>org.fusesource.restygwt</groupId>
    <artifactId>restygwt</artifactId>
    <version>2.2.0</version>
    <scope>provided</scope>
  </dependency>
</dependencies>
@jnehlmeier
Copy link
Member

Check your dependency tree. Looks like a version conflict with JDT / ECJ and GWT now uses a wrong (most likely older) version.

@tbroyer
Copy link
Member

tbroyer commented Oct 19, 2016

The problem here is that both dagger-compiler and gwt-dev bring Eclipse JDT (see google/dagger#228), and those versions conflict.

Because dagger-compiler is an annotation processor, you can use maven-compiler-plugin 3.5.1 and its annotationProcessorPaths to cleanly separate things out: dagger-compiler will be in the processor path during JavaC compilation, and gwt-dev will be in classpath during GWT compilation.

@tbroyer tbroyer closed this as completed Oct 19, 2016
@Martin-Luft
Copy link
Author

@tbroyer thanks, moving dagger-compiler from dependencies to annotationProcessorPaths and adding

<dependency>
  <groupId>com.google.code.findbugs</groupId>
  <artifactId>jsr305</artifactId>
  <version>3.0.0</version>
</dependency>

solved the problem.

@ibaca
Copy link
Contributor

ibaca commented Oct 20, 2016

Not a good option, but kind of curious; if the gwt-dev dependency appears before the dagger-compiler dependency project compiles correctly.

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

4 participants