GWT 编译器 NoSuchMethodError

GWT Compiler NoSuchMethodError

我的 GWT 编译器开始失败并出现 NoSuchMethodError。当我将方法参数从 Long 更新为 long 时,它开始发生。我不需要,但我尝试将其切换回来,但我仍然遇到同样的错误。我的 java eclipse 运行时编译器没有将该行视为错误,并且在开发模式下一切正常 运行。

Caused by: java.lang.NoSuchMethodError: com.dscicorp.ribeye.shared.dto.Data.put(Ljava/lang/String;Ljava/lang/Long)Ljava/lang/String;

所以它似乎将 long's 和 Long's 视为不同的类型。这是实际方法的样子:

public String put(String key, long value) {
    return put(key, Long.toString(value));
}

我不确定这是否与它有关,但在错误消息中它输出的行与我的代码中的略有不同。它将长变量 "val" 替换为 "Long.valueOf(val)".

this.this.reportOptions.put("noteTypes", Long.valueOf(val))

我尝试添加长版本和长版本以查看它是否解决了这个问题,它确实解决了,但它在另一个地方出现了类似的错误。这是 GWT 错误还是我可能配置错误?

这是完整的编译器日志:

gwtc:
 [java] Compiling module com.dscicorp.ribeye.RibEye
 [java]    Computing all possible rebind results for 'com.dscicorp.ribeye.client.generated.ReflectiveFactory'
 [java]       Rebinding com.dscicorp.ribeye.client.generated.ReflectiveFactory
 [java]          Invoking generator com.dscicorp.ribeye.generator.FactoryGenerator
 [java]             Generating source for com.dscicorp.ribeye.client.generated.ReflectiveFactory
 [java]       Rebinding com.dscicorp.ribeye.client.generated.ReflectiveFactory
 [java]          Invoking generator com.dscicorp.ribeye.generator.FactoryGenerator
 [java]             Generating source for com.dscicorp.ribeye.client.generated.ReflectiveFactory
 [java]       Rebinding com.dscicorp.ribeye.client.generated.ReflectiveFactory
 [java]          Invoking generator com.dscicorp.ribeye.generator.FactoryGenerator
 [java]             Generating source for com.dscicorp.ribeye.client.generated.ReflectiveFactory
 [java]       Rebinding com.dscicorp.ribeye.client.generated.ReflectiveFactory
 [java]          Invoking generator com.dscicorp.ribeye.generator.FactoryGenerator
 [java]             Generating source for com.dscicorp.ribeye.client.generated.ReflectiveFactory
 [java]       Rebinding com.dscicorp.ribeye.client.generated.ReflectiveFactory
 [java]          Invoking generator com.dscicorp.ribeye.generator.FactoryGenerator
 [java]             Generating source for com.dscicorp.ribeye.client.generated.ReflectiveFactory
 [java]    [ERROR] An internal compiler exception occurred
 [java] com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.
 [java]     at com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:121)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:296)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285)
 [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:128)
 [java]     at com.google.gwt.dev.jjs.ast.JExpressionStatement.traverse(JExpressionStatement.java:42)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:95)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:351)
 [java]     at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:92)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293)
 [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:149)
 [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse(JIfStatement.java:53)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:95)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:351)
 [java]     at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:92)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293)
 [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:149)
 [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:145)
 [java]     at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:83)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285)
 [java]     at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:600)
 [java]     at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:569)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285)
 [java]     at com.google.gwt.dev.jjs.impl.UnifyAst.mainLoop(UnifyAst.java:1505)
 [java]     at com.google.gwt.dev.jjs.impl.UnifyAst.exec(UnifyAst.java:870)
 [java]     at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.unifyJavaAst(JavaToJavaScriptCompiler.java:1305)
 [java]     at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.constructJavaAst(JavaToJavaScriptCompiler.java:1038)
 [java]     at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.precompile(JavaToJavaScriptCompiler.java:954)
 [java]     at com.google.gwt.dev.jjs.MonolithicJavaToJavaScriptCompiler.precompile(MonolithicJavaToJavaScriptCompiler.java:303)
 [java]     at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:38)
 [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:286)
 [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:229)
 [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
 [java]     at com.google.gwt.dev.Compiler.run(Compiler.java:206)
 [java]     at com.google.gwt.dev.Compiler.run(Compiler.java:158)
 [java]     at com.google.gwt.dev.Compiler.run(Compiler.java:120)
 [java]     at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
 [java]     at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
 [java]     at com.google.gwt.dev.Compiler.main(Compiler.java:127)
 [java] Caused by: java.lang.NoSuchMethodError: com.dscicorp.ribeye.shared.dto.Data.put(Ljava/lang/String;Ljava/lang/Long;)Ljava/lang/String;
 [java]     at com.google.gwt.dev.jjs.impl.UnifyAst.translate(UnifyAst.java:1715)
 [java]     at com.google.gwt.dev.jjs.impl.UnifyAst.access00(UnifyAst.java:134)
 [java]     at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.visit(UnifyAst.java:416)
 [java]     at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:245)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381)
 [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293)
 [java]     ... 42 more
 [java]       [ERROR] at MasterWorkLogSearchReportPage.java(281): this.this.reportOptions.put("noteTypes", Long.valueOf(val))
 [java]          com.google.gwt.dev.jjs.ast.JMethodCall
 [java]       [ERROR] at MasterWorkLogSearchReportPage.java(281): this.this.reportOptions.put("noteTypes", Long.valueOf(val))
 [java]          com.google.gwt.dev.jjs.ast.JExpressionStatement
 [java]       [ERROR] at MasterWorkLogSearchReportPage.java(280): {
 [java]   this.this.reportOptions.put("noteTypes", Long.valueOf(val));
 [java] }
 [java]          com.google.gwt.dev.jjs.ast.JBlock
 [java]       [ERROR] at MasterWorkLogSearchReportPage.java(280): if (val > 0) {
 [java]   this.this.reportOptions.put("noteTypes", Long.valueOf(val));
 [java] } else {
 [java]   this.this.reportOptions.remove("noteTypes");
 [java] }
 [java]          com.google.gwt.dev.jjs.ast.JIfStatement
 [java]       [ERROR] at MasterWorkLogSearchReportPage.java(277): {
 [java]   long val = this.this.getNoteTypesValue();
 [java]   if (val > 0) {
 [java]     this.this.reportOptions.put("noteTypes", Long.valueOf(val));
 [java]   } else {
 [java]     this.this.reportOptions.remove("noteTypes");
 [java]   }
 [java] }
 [java]          com.google.gwt.dev.jjs.ast.JBlock
 [java]       [ERROR] at MasterWorkLogSearchReportPage.java(277): {
 [java]   long val = this.this.getNoteTypesValue();
 [java]   if (val > 0) {
 [java]     this.this.reportOptions.put("noteTypes", Long.valueOf(val));
 [java]   } else {
 [java]     this.this.reportOptions.remove("noteTypes");
 [java]   }
 [java] }
 [java]          com.google.gwt.dev.jjs.ast.JMethodBody
 [java]       [ERROR] at MasterWorkLogSearchReportPage.java(277): public void execute();
 [java] 
 [java]          com.google.gwt.dev.jjs.ast.JMethod

我通过创建一个新的 Eclipse 项目并导入相同的代码解决了这个问题。这可能是某种类型的缓存问题,但清除我的 gwt-unitCache 目录并没有解决它。