eclipse-jdt / eclipse.jdt.ui

Eclipse Public License 2.0
36 stars 87 forks source link

Eclipse 4.32 offers the execution environment JavaSE-23, although it is not yet supported #1448

Closed howlger closed 1 month ago

howlger commented 3 months ago

In the Eclipse SDK 4.32, in the New Java Project dialog, in the Use an execution environment JRE drop-down menu, JavaSE-23 is offered as an option, although it is not yet supported.

See also: https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1349#issuecomment-2144428116

akurtakov commented 3 months ago

Running with JavaSE-23 EE is supported as this mandates the EE one wants to run with but it doesn't mandate that the bytecode generated from the project should be at level 23. E.g. I can require using JavaSE-23 EE as my project uses new APIs in Java 23 despite the fact that the project will be compiled to Java 22(or older). What am I missing here?

iloveeclipse commented 3 months ago

What am I missing here?

It is not about running but about compilation level. After this wizard is done, we allow & set Java 23 in compiler preferences for the project but generate and support only Java 22. So user assumes he can use Java 23 JLS but he can't actually.

akurtakov commented 3 months ago

image Screenshot from 2024-06-11 12-02-04

None of them seems to allow setting 23

iloveeclipse commented 3 months ago

None of them seems to allow setting 23

But the actual compiler options file has 23!

akurtakov commented 3 months ago

Now I understand the issue.

howlger commented 3 months ago

The Java compiler setting Use compliance from execution environment 'JavaSE-23' on the 'Java Build Path' does not do what it says, or at least what a user would expect. From the user's point of view the differences between JavaSE-22 and JavaSE-23 are not shown in the Package/Project Explorer, nor in the Java compiler setting (a user will not look at greyed-out/disabled fields).

akurtakov commented 3 months ago

@iloveeclipse What do you think of the approach taken in https://github.com/akurtakov/eclipse.jdt.ui/commit/7a2ac1b9b2010b2a76052c42dec676749a5d5716 ? If this looks fine as idea I'll finish it. Btw, is there any public API to achieve the same as CompilerOptions.getLatestVersion() ?

iloveeclipse commented 3 months ago

What do you think of the approach taken in akurtakov@7a2ac1b ? If this looks fine as idea I'll finish it. Btw, is there any public API to achieve the same as CompilerOptions.getLatestVersion() ?

See my ideas / comments on https://github.com/eclipse-jdt/eclipse.jdt.core/pull/2606

akurtakov commented 3 months ago

I don't see this directly benefiting the use case here (EE version that the compiler doesn't know about yet) but I will wait for the API changes to shape up before looking further into this one to reduce cross-fire.

iloveeclipse commented 3 months ago

I don't see this directly benefiting the use case here (EE version that the compiler doesn't know about yet)

Exact this use case could be avoided with new API, so Java 23 EE would not appear as allowed EE because there is no compiler support for that.

but I will wait for the API changes to shape up before looking further into this one to reduce cross-fire.

See changes on

For this ticket, the only additional change would be to restrict JavaCore.SUPPORTED_VERSIONS to exclude versions past CompilerOptions.getLatestVersion().

howlger commented 1 month ago

Closed: in the Eclipse SDK 4.33RC2, in the New Java Project dialog, in the Use an execution environment JRE drop-down menu, JavaSE-23 is no longer offered as an option.