gwtproject / gwt

GWT Open Source Project
http://www.gwtproject.org
1.51k stars 373 forks source link

Compile error - GWT Google Web Toolkit (2.10.0, 2.10.1, 2.11.0) on java17. #9929

Closed Dejiva closed 7 months ago

Dejiva commented 7 months ago

Unable to Compile on latest GWT Google Web Toolkit (2.10.0, 2.10.1, 2.11.0) on java17, getting error as below. Source level must be one of [auto, 1.8, 9, 10, 11]. Google Web Toolkit 2.11.0

We are upgrading our Java projects from Java11 to Java17 as mentioned in the release note here "https://www.gwtproject.org/release-notes.html", and upgraded GWT from 2.9.0 to 2.10.0 which supports java17 when we try to compile it but failing(eclipse GWT plugin and maven plugins) I tried with a simple code snippet too, but I ended up with the same error.

Please, anybody, help/guide me to compile and build my project in java17. Note: I don't want to pass -sourceLevel 11 argument to compile on 17

Thanks,

jnehlmeier commented 7 months ago

What is the actual error?

Dejiva commented 7 months ago

Error is getting as below then stops the compilation. Source level must be one of [auto, 1.8, 9, 10, 11]. Google Web Toolkit 2.11.0

image
bpetridean commented 7 months ago

Note: I don't want to pass -sourceLevel 11 argument to compile on 17

Why not?

bpetridean commented 7 months ago

btw: are u using GIN?

Dejiva commented 7 months ago

btw: are u using GIN?

No

Dejiva commented 7 months ago

Note: I don't want to pass -sourceLevel 11 argument to compile on 17

Why not?

Don't want to bypass the java17 compiler.

bpetridean commented 7 months ago

Since source level 17 is not available with gwt 2.11.0 and AFAIK if you do not set a value it should resolve to source level 1.8, you're left with one choice....

For what is worth in my configs I am setting the source level to 11 According to @niloc132 in order to get the new lang features you'll have to set source level to either auto or 11

PS: but I do see your point

Dejiva commented 7 months ago

Since source level 17 is not available with gwt 2.11.0 and AFAIK if you do not set a value it should resolve to source level 1.8, you're left with one choice....

For what is worth in my configs I am setting the source level to 11

PS: but I do see your point

Do you mean, it won't support java17 compiler? Our project is upgrading to java17 so, all its modules should be compiled by 17 only. I just want to make sure why it's not allowing to compile in "17" even though it was mentioned in GWT release document.

zbynek commented 7 months ago

You can run the compiler with JDK 17, but you cannot use Java 17 language features. Those will be added in GWT 2.12 and the progress is tracked here: https://github.com/gwtproject/gwt/issues/9869

bpetridean commented 7 months ago

Also see this gitter thread

jnehlmeier commented 7 months ago

Since source level 17 is not available with gwt 2.11.0 and AFAIK if you do not set a value it should resolve to source level 1.8, you're left with one choice.... For what is worth in my configs I am setting the source level to 11 PS: but I do see your point

Do you mean, it won't support java17 compiler? Our project is upgrading to java17 so, all its modules should be compiled by 17 only. I just want to make sure why it's not allowing to compile in "17" even though it was mentioned in GWT release document.

You can use JDK 17 to compile your project and also use it to start the GWT compiler. The sourceLevel argument defines which Java language features the GWT compiler will accept while compiling your Java code to JavaScript. That is independent of the JVM you are using to compile your app and run the GWT compiler.

jnehlmeier commented 7 months ago

Closing the issue because -sourceLevel 17 is expected to fail with GWT 2.11 as GWT only understands language features up to Java 11.

Dejiva commented 7 months ago

Thank you all for your support and quick response.