-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
21.0.3
-
x86_64
-
windows
ADDITIONAL SYSTEM INFORMATION :
Intel i/-12700F
Windows 11 23H2
Android Studio Jellyfish 2023.3.1 Patch 1
A DESCRIPTION OF THE PROBLEM :
Recently discovered the new patterns in Java 21 and decided to try it out in an Android project. However, compilation fails with the following error
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for java.lang.runtime.SwitchBootstraps not found
As long as I remove the pattern matching to types, the project compiles. See the "Source code for an executable test case" I have provided below.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use code below
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code compiles
ACTUAL -
Code fails to compile
---------- BEGIN SOURCE ----------
public class Reproducable {
static <T> void test(T value) {
switch (value) {
case Integer i -> System.out.println("Integer");
case Float f -> System.out.println("Float");
case Boolean b -> System.out.println("Boolean");
default -> System.out.println("Some other type");
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround, going to go back to good old if-else statements.
FREQUENCY : always
Intel i/-12700F
Windows 11 23H2
Android Studio Jellyfish 2023.3.1 Patch 1
A DESCRIPTION OF THE PROBLEM :
Recently discovered the new patterns in Java 21 and decided to try it out in an Android project. However, compilation fails with the following error
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for java.lang.runtime.SwitchBootstraps not found
As long as I remove the pattern matching to types, the project compiles. See the "Source code for an executable test case" I have provided below.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use code below
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code compiles
ACTUAL -
Code fails to compile
---------- BEGIN SOURCE ----------
public class Reproducable {
static <T> void test(T value) {
switch (value) {
case Integer i -> System.out.println("Integer");
case Float f -> System.out.println("Float");
case Boolean b -> System.out.println("Boolean");
default -> System.out.println("Some other type");
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround, going to go back to good old if-else statements.
FREQUENCY : always