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

vikas kumar prabhakar updated NETBEANS-1675:
--------------------------------------------
    Description: 
Code:

int i=10;
 final String val = 
 switch (i) 

{ case 1 : break "one"; case 2 -> "two"; }

;

Error will be displayed in editor 'different case kinds used in the switch' 

Proposed fix:

Scenario 1: Switch Statements

int k = 1;

switch(k) {

 case 1 :

         System.out.println( "one");

         break;

  case 2 -> System.out.println( "two");

}

After Fix:

ink k = 1;

switch (k){

 case 1 -> System.out.println( "one");

  case 2 -> System.out.println( "two");

}

Scenario 2: Switch Expression

int k= 1;
var  val = 
 switch(k){

case 1 :

      break("one");

case 2 -> "two";

};

After Fix:

int k= 1;
var  val = 
switch(k){

case 1 ->  "one";

case 2 -> "two";

};

 

  was:
Code:

int i=10;
 final String val = 
 switch (i) 
 { 
 case 1 : break "one"; 
 case 2 -> "two"; 
 };

Error will be displayed in editor 'different case kinds used in the switch' 

Proposed fix:

int i=10;
 final String val = 
 switch (i) 
 { 
 case 1 -> "one"; 
 case 2 -> "two"; 
 };

 


> Java Hint to fix error :different case kinds used in the switch in switch 
> expressions
> -------------------------------------------------------------------------------------
>
>                 Key: NETBEANS-1675
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-1675
>             Project: NetBeans
>          Issue Type: Improvement
>            Reporter: ARUNAVA SINHA
>            Assignee: vikas kumar prabhakar
>            Priority: Major
>              Labels: NB-JDK12
>
> Code:
> int i=10;
>  final String val = 
>  switch (i) 
> { case 1 : break "one"; case 2 -> "two"; }
> ;
> Error will be displayed in editor 'different case kinds used in the switch' 
> Proposed fix:
> Scenario 1: Switch Statements
> int k = 1;
> switch(k) {
>  case 1 :
>          System.out.println( "one");
>          break;
>   case 2 -> System.out.println( "two");
> }
> After Fix:
> ink k = 1;
> switch (k){
>  case 1 -> System.out.println( "one");
>   case 2 -> System.out.println( "two");
> }
> Scenario 2: Switch Expression
> int k= 1;
> var  val = 
>  switch(k){
> case 1 :
>       break("one");
> case 2 -> "two";
> };
> After Fix:
> int k= 1;
> var  val = 
> switch(k){
> case 1 ->  "one";
> case 2 -> "two";
> };
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to