-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
18
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
only tested on Ubuntu 22.04.2 LTS.
A DESCRIPTION OF THE PROBLEM :
when tried to compile a code with a switch case, a bug pops up.
REGRESSION : Last worked in version 18
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
class Main{
public static void main(String ... args){
String operator = "+";
String writtenOperator = (switch(operator){
case "+" -> "PLUS";
case "-" -> "Minus";
default -> "Unbekannter Operator";
}).toUpperCase();
System.out.printf("%s\n", writtenOperator);
}
}
then just try to compile with: javac Main.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The result should be in this case just a "PLUS"
ACTUAL -
result can only be seen if its not compiled but directly interpreted with:
java Main.java
---------- BEGIN SOURCE ----------
see steps to reproduce.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
see Actual Result. or with If-else.
FREQUENCY : always
only tested on Ubuntu 22.04.2 LTS.
A DESCRIPTION OF THE PROBLEM :
when tried to compile a code with a switch case, a bug pops up.
REGRESSION : Last worked in version 18
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
class Main{
public static void main(String ... args){
String operator = "+";
String writtenOperator = (switch(operator){
case "+" -> "PLUS";
case "-" -> "Minus";
default -> "Unbekannter Operator";
}).toUpperCase();
System.out.printf("%s\n", writtenOperator);
}
}
then just try to compile with: javac Main.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The result should be in this case just a "PLUS"
ACTUAL -
result can only be seen if its not compiled but directly interpreted with:
java Main.java
---------- BEGIN SOURCE ----------
see steps to reproduce.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
see Actual Result. or with If-else.
FREQUENCY : always