-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
17
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
windows 11 / JDK 17.0.1
A DESCRIPTION OF THE PROBLEM :
The switch expression in Jshell is finished with " default... ; " After that, you want to wrap the line to add the last " }; " , Now you get an Error "The end of the file was reached when the syntax analysis was performed"
REGRESSION : Last worked in version 17.0.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
jshell> String result;
result ==> null
| created variable result : String
jshell> String language = "English";
language ==> "English"
| created variable language : String
jshell> result = switch (language) {
...> case "English" -> "Hello";
...> case "Spanish" -> "Hola";
...> default -> throw new RuntimeException("Unsupported language");
Copy the code above and click the enter button directly to reproduce the exception
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Print the results correctly : Hello
ACTUAL -
The end of the file was reached when the syntax analysis was performed
---------- BEGIN SOURCE ----------
jshell> String result;
result ==> null
| created variable result : String
jshell> String language = "English";
language ==> "English"
| created variable language : String
jshell> result = switch (language) {
...> case "English" -> "Hello";
...> case "Spanish" -> "Hola";
...> default -> throw new RuntimeException("Unsupported language");
Copy the code above and click the enter button directly to reproduce the exception
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
There is no solution at this time
FREQUENCY : always
windows 11 / JDK 17.0.1
A DESCRIPTION OF THE PROBLEM :
The switch expression in Jshell is finished with " default... ; " After that, you want to wrap the line to add the last " }; " , Now you get an Error "The end of the file was reached when the syntax analysis was performed"
REGRESSION : Last worked in version 17.0.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
jshell> String result;
result ==> null
| created variable result : String
jshell> String language = "English";
language ==> "English"
| created variable language : String
jshell> result = switch (language) {
...> case "English" -> "Hello";
...> case "Spanish" -> "Hola";
...> default -> throw new RuntimeException("Unsupported language");
Copy the code above and click the enter button directly to reproduce the exception
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Print the results correctly : Hello
ACTUAL -
The end of the file was reached when the syntax analysis was performed
---------- BEGIN SOURCE ----------
jshell> String result;
result ==> null
| created variable result : String
jshell> String language = "English";
language ==> "English"
| created variable language : String
jshell> result = switch (language) {
...> case "English" -> "Hello";
...> case "Spanish" -> "Hola";
...> default -> throw new RuntimeException("Unsupported language");
Copy the code above and click the enter button directly to reproduce the exception
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
There is no solution at this time
FREQUENCY : always
- duplicates
-
JDK-8276149 jshell throws EOF error when throwing exception inside switch expression
-
- Resolved
-