本文介绍了GWT-构建Java AST时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编译过程中可能导致此错误的原因是什么?

What could possibly be causing this error during compilation?

我已从此原型 https://github.com/ArcBees/Arcbees-Archetypes 而我只更改了-将GWT更新为2.8.0,将GWTP更新为1.5.3.

I have generated project from this archetype https://github.com/ArcBees/Arcbees-Archetypes and I have changed only thing - update GWT to 2.8.0 and GWTP to 1.5.3.

[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:3099)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.endVisit(GwtAstBuilder.java:352)
[INFO]  at org.eclipse.jdt.internal.compiler.ast.AllocationExpression.traverse(AllocationExpression.java:670)
[INFO]  at org.eclipse.jdt.internal.compiler.ast.Assignment.traverse(Assignment.java:260)
[INFO]  at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:347)
[INFO]  at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1379)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.process(GwtAstBuilder.java:3058)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$UnitProcessorImpl.process(CompilationStateBuilder.java:141)
[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:985)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:339)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:580)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:513)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:499)
[INFO]  at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:668)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:255)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:229)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
[INFO]  at com.google.gwt.dev.Compiler.run(Compiler.java:206)
[INFO]  at com.google.gwt.dev.Compiler.run(Compiler.java:158)
[INFO]  at com.google.gwt.dev.Compiler$1.run(Compiler.java:120)
[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:127)
[INFO] Caused by: java.lang.NullPointerException
[INFO]  at com.google.gwt.dev.jjs.impl.ReferenceMapper.get(ReferenceMapper.java:99)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.pushNewExpression(GwtAstBuilder.java:2642)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.endVisit(GwtAstBuilder.java:350)
[INFO]  ... 23 more
[INFO]    [ERROR] at AbstractStringBuilder.java(137): new String(buffer)
[INFO]       org.eclipse.jdt.internal.compiler.ast.AllocationExpression
[INFO] Shutting down PersistentUnitCache thread

推荐答案

pom.xml生成的GWTP原型对gwt-dev-2.7.0具有隐式依赖性,从而导致版本不匹配.尝试将显式依赖项添加到2.8.0:

The pom.xml generated GWTP archetype has an implicit dependency to gwt-dev-2.7.0, resulting in a version mismatch. Try adding an explicit dependency to 2.8.0:

    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-dev</artifactId>
        <version>2.8.0</version>
        <scope>provided</scope>
    </dependency>

这篇关于GWT-构建Java AST时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-07 22:53