1

I had issues with GWT compiles. I am using GWT 2.7.0 and I use Java 8.

When I start dev-mod I get this exception :

java.lang.NoSuchFieldError: originalSourceLevel
at com.google.gwt.dev.javac.JdtCompiler.getStandardCompilerOptions(JdtCompiler.java:611)
at com.google.gwt.dev.javac.JdtCompiler.getCompilerOptions(JdtCompiler.java:633)
at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:983)
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.codeserver.Recompiler.initWithoutPrecompile(Recompiler.java:200)
at com.google.gwt.dev.codeserver.Outbox.maybePrecompile(Outbox.java:82)
at com.google.gwt.dev.codeserver.Outbox.<init>(Outbox.java:61)
at com.google.gwt.dev.codeserver.CodeServer.makeOutboxes(CodeServer.java:156)
at com.google.gwt.dev.codeserver.CodeServer.start(CodeServer.java:118)
at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:91)
at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.gwt.dev.shell.SuperDevListener$1.run(SuperDevListener.java:84)

I added <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath> in my pom.xml and still the same problem. Any suggestion please?

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
user3816170
  • 319
  • 12
  • 20
  • As far as I know, Java 8 is not supported in GWT 2.7.0. GWT 2.8.0 will be the first GWT version with a limited Java 8 support. http://stackoverflow.com/questions/29913237/is-java-8-compatable-with-gwt-2-6-or-2-7/29916083#29916083 see also here: http://stackoverflow.com/questions/15693169/java-8-support-in-gwt/15693528#15693528 – El Hoss Oct 23 '15 at 08:13
  • And found this: When using Java8 you should add -sourceLevel 1.7 parameter to DevMode/CodeServer/Compiler. here http://grokbase.com/t/gg/google-web-toolkit/154wjbj2hd/java-8-is-compatable-with-gwt-2-6-or-2-7 – El Hoss Oct 23 '15 at 08:16
  • i added sourceLevel 1.7 parameter to DevMode/CodeServer and changed java8 to java7 and still the same exception – user3816170 Oct 23 '15 at 08:46
  • @el-hoss GWT 2.7 can run completely fine with a Java 8 runtime. What isn't supported is Java 8 language constructs in sources compiled by GWT to JS. – Thomas Broyer Oct 23 '15 at 08:51
  • @Thomas Broyer: That's why I referenced the links to clearify this. The statement "is not supported " is related to some of the new features in Java 8. – El Hoss Oct 23 '15 at 09:22
  • 1
    @user3816170: Is it possible that you have an old version of the JdtCompiler on the classpath? – El Hoss Oct 23 '15 at 09:27
  • @ElHoss but "I use Java 8" in the OP is likely not related to "I use some Java 8 features in my sources" but rather to "I use a Java 8 runtime"; and using Java 8 features in the sources would not lead to a `NoSuchFieldError` anyway. So IMO your initial comment was unhelpful and misleading. – Thomas Broyer Oct 23 '15 at 09:55
  • @user3816170 See https://vaadin.com/forum#!/thread/3915945 which hints at the same JDT classpath issue as El Hoss suggests. I find it strange that `gwtSdkFirstInClasspath` wouldn't solve it though… – Thomas Broyer Oct 23 '15 at 09:56
  • that what configured in my pom.xml : '${gwt.version} true true ${webappDirectory} 180 2 -Xss2048k -Xmx1024M INFO true' – user3816170 Oct 23 '15 at 10:08
  • @Thomas Broyer: you are right. After some digging in the web, I realized that it should be classpath issue. – El Hoss Oct 23 '15 at 10:10
  • @El Hoss can you give me more explanation – user3816170 Oct 23 '15 at 10:20
  • I found some hints in the web: the one Thomas mentioned and this two: http://stackoverflow.com/questions/25689458/gwt-2-6-1-unknown-compile-issue and http://stackoverflow.com/questions/7429076/error-with-web-application-eclipse-spring-gwt-reportunuseddeclaredthrownex with similar errors – El Hoss Oct 23 '15 at 10:48
  • I moved the GWT SDK bundle above any other library but still have the same problem ! – user3816170 Oct 23 '15 at 14:09

1 Answers1

0

I find using GWT 2.8.0-SNAPSHOT (nightly) works best with Java 1.8 app. That doesn't mean it won't work with 2.7, like the folks said above. Although I'm not worried about breaking changes either, as I think it's in the last stages of formulation before release.

Brandon
  • 2,034
  • 20
  • 25