You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "juersimon (via GitHub)" <gi...@apache.org> on 2023/03/26 17:47:58 UTC
[GitHub] [netbeans] juersimon opened a new issue, #5723: Exception: Uncompilable code at instanceof with pattern matching JDK-17 debug / run in Netbeans
juersimon opened a new issue, #5723:
URL: https://github.com/apache/netbeans/issues/5723
### Apache NetBeans version
Apache NetBeans 17
### What happened
When using instanceof with pattern matching a RuntimeException Uncompilable code is thrown with JDK 17 if the program is started in Netbeans with run or debug . The generated jar runs without errors.
This behavior is also the case with JDK 18, JDK 19/20 work.
`
Number n = Long.valueOf(1);
if (n instanceof Long l) {
System.out.println("Long: " + l);
}
`
### How to reproduce
The error occurs when an Ant project is created and Compile on Save is activated. JDK 17 (or 18) is selected as the Java platform. The default platform is irrelevant. JDK 17 is used as source/binary format.
The following compiles without errors and the jar produced runs with Java 17. If the program is started with debog or run in Netbeans, then the exception is thrown. If JDK 19 or JDK 20 is selected as platform, run and debug work without error.
`public class Netbeans17Instanceof {
public static void main(String[] args) {
try {
Number n = Long.valueOf(1);
if (n instanceof Long l) {
System.out.println("Long: " + l);
}
} catch (Exception ex) {
ex.printStackTrace(System.err);
}
}
}`
### Did this work correctly in an earlier version?
Apache NetBeans 15
### Operating System
Windows 10 / Ubuntu 22.04.02
### JDK
adoptium 17.0.6
### Apache NetBeans packaging
Apache NetBeans provided installer
### Anything else
_No response_
### Are you willing to submit a pull request?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] neilcsmith-net commented on issue #5723: Exception: Uncompilable code at instanceof with pattern matching JDK-17 debug / run in Netbeans
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on issue #5723:
URL: https://github.com/apache/netbeans/issues/5723#issuecomment-1484170841
Thanks for the report. This is a duplicate of #5260 and already fixed in master. Will be in NB18. Workaround is to disable compile on save.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] neilcsmith-net closed issue #5723: Exception: Uncompilable code at instanceof with pattern matching JDK-17 debug / run in Netbeans
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net closed issue #5723: Exception: Uncompilable code at instanceof with pattern matching JDK-17 debug / run in Netbeans
URL: https://github.com/apache/netbeans/issues/5723
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists