JavaCompilerCore/resources/bytecode/javFiles/GenericRecordSwitchCase.jav

25 lines
439 B
Plaintext
Raw Normal View History

import java.lang.String;
2024-09-04 08:42:11 +00:00
import java.lang.Integer;
2024-09-04 08:42:11 +00:00
sealed interface List permits LinkedElem, Elem {}
2024-09-04 08:42:11 +00:00
public record LinkedElem<T>(T a,List l) implements List{}
public record Elem<T>(T c) implements List{}
2024-09-04 08:42:11 +00:00
public class GenericRecordSwitchCase {
public main(o) {
return switch(o) {
case LinkedElem(a, Elem(e)) -> a ;
2024-09-04 08:42:11 +00:00
case LinkedElem(a, LinkedElem(e, Elem(f))) -> a;
};
}
}