[ 
https://issues.apache.org/jira/browse/NETBEANS-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ARUNAVA SINHA updated NETBEANS-2745:
------------------------------------
    Description: 
isuue is linked to https://issues.apache.org/jira/browse/NETBEANS-2349

 

Convert old switch statement to switch expression in following case:

Old code:  (Assign same variable in every case with one statement)

int x = 5;
 String str = "foo";
 switch (str)

{ case 1: str = "bar";break; case 2: str = "baz";break; default: str = "zuq" }

 

expected fix:

int x = 5;
 String s = switch (str)

{ case 1 -> "bar"; case 2 -> "baz"; default -> "zuq"; }

But the hint is disabled in above scenario.

  was:
Convert old switch statement to switch expression in following case:

Old code:  (Assign same variable in every case with one statement)

int x = 5;
String str = "foo";
switch (str)

{ case 1: str = "bar";break;

case 2: str = "baz";break;

default: str = "zuq"

}

 

expected fix:

int x = 5;
String s = switch (str)

{ case 1 -> "bar";

case 2 -> "baz";

default -> "zuq";

}

But the hint is disabled in above scenario.


> hint : Convert switch to switch expression not displayed when switch have 
> default case without break
> ----------------------------------------------------------------------------------------------------
>
>                 Key: NETBEANS-2745
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-2745
>             Project: NetBeans
>          Issue Type: Task
>          Components: java - Hints
>    Affects Versions: 11.1
>            Reporter: ARUNAVA SINHA
>            Assignee: ARUNAVA SINHA
>            Priority: Major
>
> isuue is linked to https://issues.apache.org/jira/browse/NETBEANS-2349
>  
> Convert old switch statement to switch expression in following case:
> Old code:  (Assign same variable in every case with one statement)
> int x = 5;
>  String str = "foo";
>  switch (str)
> { case 1: str = "bar";break; case 2: str = "baz";break; default: str = "zuq" }
>  
> expected fix:
> int x = 5;
>  String s = switch (str)
> { case 1 -> "bar"; case 2 -> "baz"; default -> "zuq"; }
> But the hint is disabled in above scenario.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
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

Reply via email to