简体   繁体   中英

GWT Compilation error in Eclipse Oxygen

I'm getting these weird errors when I try to compile my Libgdx game to HTML5 in Eclipse.

Tracing compile failure path for type 'java.util.function.DoubleUnaryOperator'
     [ERROR] Errors in 'com/google/gwt/emul/java/util/function/DoubleUnaryOperator.java'
     [ERROR] Line 33: Default methods are allowed only at source level 1.8 or above
     [ERROR] Line 35: Cannot refer to the non-final local variable after defined in an enclosing scope
     [ERROR] Line 40: Cannot refer to the non-final local variable before defined in an enclosing scope
     [ERROR] Line 40: Lambda expressions are allowed only at source level 1.8 or above
     [ERROR] Line 35: Lambda expressions are allowed only at source level 1.8 or above
     [ERROR] Line 38: Default methods are allowed only at source level 1.8 or above
     [ERROR] Line 27: Illegal modifier for the interface method identity; only public & abstract are permitted
     [ERROR] Line 27: Static methods are allowed in interfaces only at source level 1.8 or above
     [ERROR] Line 28: Lambda expressions are allowed only at source level 1.8 or above
Tracing compile failure path for type 'java.util.stream.Collectors'
  [ERROR] Errors in 'com/google/gwt/emul/java/util/stream/Collectors.java'
     [ERROR] Line 291: This static method of interface Collector can only be accessed as Collector.of
     [ERROR] Line 348: Lambda expressions are allowed only at source level 1.8 or above
     [ERROR] Line 96: Lambda expressions are allowed only at source level 1.8 or above
     [ERROR] Line 223: The method of(Supplier<R>, BiConsumer<R,T>, BinaryOperator<R>, Collector.Characteristics...) in the type Collector is not applicable for the arguments (() -> {}, (<no type> u, <no type> t) -> {}, (Object[] u1, Object[] u2) -> {}, (Object[] a) -> {})
     [ERROR] Line 311: Constructor references are allowed only at source level 1.8 or above
     [ERROR] Line 192: Method references are allowed only at source level 1.8 or above
     [ERROR] Line 205: Lambda expressions are allowed only at source level 1.8 or above
     [ERROR] Line 143: Constructor references are allowed only at source level 1.8 or above
     [ERROR] Line 168: Lambda expressions are allowed only at source level 1.8 or above
     [ERROR] Line 339: Lambda expressions are allowed only at source level 1.8 or above...

In my build.gradle, I've checked that the gwtVersion is using 2.7.0 and my sourceCompatibility is at 1.8. I've been at this thing for days and I can't seem to figure it out.

Help!!!

UPDATED

Thank you Colin for the feedback. Here's the error I'm getting now:

[ERROR] An internal compiler exception occurred com.google.gwt.dev.jjs.InternalCompilerException: Error constructing Java AST at com.google.gwt.dev.jjs.impl.GwtAstBuilder.translateException(GwtAstBuilder.java:3099) at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.endVisit(GwtAstBuilder.java:352) at org.eclipse.jdt.internal.compiler.ast.AllocationExpression.traverse(AllocationExpression.java:670) at org.eclipse.jdt.internal.compiler.ast.ReturnStatement.traverse(ReturnStatement.java:373) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:347) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1379) at com.google.gwt.dev.jjs.impl.GwtAstBuilder.process(GwtAstBuilder.java:3058) at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$UnitProcessorImpl.process(CompilationStateBuilder.java:141) at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.process(JdtCompiler.java:384) at org.eclipse.jdt.inte rnal.compiler.Compiler.compile(Compiler.java:470) at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:985) at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:339) at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:580) at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:513) at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:499) at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:668) at com.google.gwt.dev.Precompile.precompile(Precompile.java:255) at com.google.gwt.dev.Precompile.precompile(Precompile.java:229) at com.google.gwt.dev.Precompile.precompile(Precompile.java:145) at com.google.gwt.dev.Compiler.run(Compiler.java:206) at com.google.gwt.dev.Compiler.run(Compiler.java:158) at com.google.gwt.dev.Compiler$1.run(Compiler.java:120) at com.google.gwt.dev.CompileTaskRunner.do Run(CompileTaskRunner.java:55) at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50) at com.google.gwt.dev.Compiler.main(Compiler.java:127) Caused by: java.lang.NullPointerException at com.google.gwt.dev.jjs.impl.ReferenceMapper.get(ReferenceMapper.java:99) at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.pushNewExpression(GwtAstBuilder.java:2642) at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.endVisit(GwtAstBuilder.java:350) ... 23 more [ERROR] at TimeZone.java(126): new String(data) org.eclipse.jdt.internal.compiler.ast.AllocationExpression

Maybe I have to update it to GWT 2.8.0?

PS: In my html\\war\\WEB-INF\\lib directory, i have the following jars:

在此处输入图片说明

Is that setup correct?

UPDATED:

Now updated to GWT 2.8.1. Now I get the following error:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.gwt.util.regexfilter.RegexFilter: method <init>()V not found
at com.google.gwt.util.regexfilter.WhitelistRegexFilter.<init>(WhitelistRegexFilter.java:21)
at com.google.gwt.dev.jjs.JJSOptionsImpl.<init>(JJSOptionsImpl.java:54)
at com.google.gwt.dev.PrecompileTaskOptionsImpl.<init>(PrecompileTaskOptionsImpl.java:39)
at com.google.gwt.dev.CompilerOptionsImpl.<init>(CompilerOptionsImpl.java:30)
at com.google.gwt.dev.Compiler.main(Compiler.java:108)

Should I clean up the (or some of the) jars that's in my html\\war\\WEB-INF\\lib directory and use other jars?

If you are using GWT 2.7, you cannot use Java8. If you want to use Java 8, upgrade to GWT 2.8 (or better, 2.8.1).

That said, if you are finding those classes at all, it suggests you have part of GWT 2.8 already on your classpath, and mixing bits and pieces from each version of GWT won't end well. Best to upgrade everything to latest, 2.8.1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM