|
|
|
|
Re: Java 21 guarded patterns in switch [message #1861807 is a reply to message #1861806] |
Sat, 04 November 2023 19:39 |
Tom Sundquist Messages: 3 Registered: November 2023 |
Junior Member |
|
|
Thank you for your replies David. I appreciate your help, and I apologize for the hasty and confusing response. Here's a more complete description:
On my Linux Mint system I have a JRE from Oracle:
$ javac --version
javac 21.0.1
$ java --version
java 21.0.1 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)
It is my understanding that eclipse does not use this compiler, although I don't know about the JVM that it uses. My version of eclipse, Version: 2023-09 (4.29.0), does not actually have support for the Java 21 execution environment (I think it is coming in December?) so I have installed a Marketplace plugin for the Java 21 support.
When I use the command line compiler I get correct behavior from the switch pattern matching, but code compiled in eclipse does not properly handle guarded patterns (assuming I have the correct interpretation of correct behavior.)
I'm new to the Eclipse Community Forums and this is my first time using the Marketplace, so I wasn't sure where to raise this issue.
Best,
Tom
|
|
|
Re: Java 21 guarded patterns in switch [message #1861809 is a reply to message #1861807] |
Sun, 05 November 2023 09:41 |
Erik Brangs Messages: 55 Registered: February 2010 |
Member |
|
|
Eclipse uses the Eclipse Compiler for Java (ECJ), which is provided by JDT.
The JVM that is used to execute code depends on what is configured for your project. Eclipses uses "Execution Environments" (e.g. something like "Java-SE21") which are mapped to installed JDKs and/or JREs. You can find the global setttings in the preferences dialog (e.g. Window -> Preferences) under Java -> Installed JREs and Java -> Installed JREs -> Execution Environments.
If the code isn't working correctly when compiled by ECJ, it could be a bug in ECJ. If you're considering reporting it, you could take a look at JDT's Github organization at https://github.com/eclipse-jdt .
There are also development builds of Eclipse that you could try to see if the bug is already fixed.
|
|
|
Powered by
FUDForum. Page generated in 0.04339 seconds