[
https://issues.apache.org/jira/browse/NETBEANS-6241?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Bien closed NETBEANS-6241.
----------------------------------
Fix Version/s: 15
Resolution: Fixed
> SwitchToRuleSwitch Hint not working with Pattern Matching Switch
> -----------------------------------------------------------------
>
> Key: NETBEANS-6241
> URL: https://issues.apache.org/jira/browse/NETBEANS-6241
> Project: NetBeans
> Issue Type: Bug
> Components: java - Hints
> Affects Versions: 12.5
> Reporter: Sandeep Mishra
> Assignee: Sandeep Mishra
> Priority: Major
> Labels: pull-request-available
> Fix For: 15
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> With the given code :
> {code:java}
> static void testSwitchStatements(Integer i) {
> switch (i) {
> case 1, 2 : System.out.println("1"); break;
> case 3 : System.out.println("3"); break;
> case Integer i : System.out.println(i);
> break;
> }
> }
> {code}
> We get the hint to covert to rule switch. The output of the hint does not
> convert the binding pattern to rule switch case.
> {code:java}
> static void testSwitchStatements(Integer i) {
> switch (i) {
> case 1, 2 -> System.out.println("1");
> case 3 -> System.out.println("3");
> case Integer i : System.out.println(i);
> break;
> }
> }
> {code}
>
> When running the hint on a switch expression :
> {code:java}
> switch (p) {
> case (Integer i && (i > 10)):
> return (String) o1;
> default :
> return (String) o2;
> }{code}
> The output is multiple default statements.
> {code:java}
> return (String) (switch (p) {
> default -> o1;
> default -> o2;
> }); {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists