[SOLVED] Eclipse 20-12 and 21-03 Java 16 [message #1836829] |
Fri, 15 January 2021 03:16 |
Michael Davies Messages: 7 Registered: August 2015 Location: Australia |
Junior Member |
|
|
My understanding was that 20-12 would recognise Java 15 and 21-03 would recognise Java 16. I appreciate 21-03 is still under development but I thought this functionality was already available.
Java 16 is not selectable as a compliance level in Eclipse. Java 15 is ok but it is not compatible with source code from Java 14 with preview features enabled. Derived objects which extend Java Objects do not have access to the parent variables. I believe this java behaviour is related JEP305 Pattern matching but was supposed to be fixed in Java16; hence my interest in using Java 16.
I give below 2 examples of pattern matching and the errors. The Button is an object which extends JButton but is not recognised. It had no problem in Java 14 with preview features enabled.
if ((c1 instanceof Button b) && (c1.getName() == "close")) {
if (tmpObject instanceof Button b) {
if (b.getText().contains("close"){
I would appreciate hearing about your experience, in particular how to get Java 16 recognised by Eclipse. I cannot find any plugins although I have installed https://download.eclipse.org/eclipse/updates/4.19-P-builds
Thank You
Mike
[Updated on: Mon, 25 January 2021 00:33] Report message to a moderator
|
|
|
|
|
|
Re: Eclipse 20-12 and 21-03 Java 16 [message #1837204 is a reply to message #1837203] |
Mon, 25 January 2021 00:31 |
Michael Davies Messages: 7 Registered: August 2015 Location: Australia |
Junior Member |
|
|
Solved my own problem. The one project I selected for testing had an incorrect build path. Other development modules I was using were included in "Projects/ModulePath" and should have been in "Projects/Classpath". All other projects I am working on were correct and worked ok under Java!6. I don't know how this one project got out of sync
Thank You
Mike
|
|
|
Powered by
FUDForum. Page generated in 0.05669 seconds