[java] Replace CreateMissingDeconstructionRecordClassBranchesFix20Test and ReplaceCaseDefaultWithDefault20FixTest with stubs

Cannot remove the tests yet, as their removal triggers re-bucketing on CI, which results in unrelated test failures
IDEA-345498 Remove explicit Java 20-preview support and parenthesized patterns (in progress)

GitOrigin-RevId: e84e4cb7f26ecc45f81bb0b04904540a9e3cac0d
This commit is contained in:
Tagir Valeev
2024-02-12 16:10:22 +01:00
committed by intellij-monorepo-bot
parent 8be49e4bb0
commit c56dbec5f8
26 changed files with 17 additions and 515 deletions

View File

@@ -1,18 +0,0 @@
// "Create missing switch branch 'Pair<I>(I x, D y)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(T x, T y) {}
class Test {
void test(Pair<I> i) {
switch (i) {
case Pair<I>(I f, I s) when Math.random() > 0.5 -> {}
case Pair<I>(I f, I s) when Math.random() > 0.1 -> {}
case Pair<I>(I f, I s) when Math.random() > 0.5 -> {}
case Pair<I>(I f, C s) -> {}
case Pair<I>(I x, D y) -> {
}
}
}
}

View File

@@ -1,27 +0,0 @@
// "Create missing switch branch 'Pair<Box,Box>(Box b1, Box b2)'" "true-preview"
record Rec(L1 l1) {}
record Pair<T, K>(T b1, K b2) {}
sealed interface Boxed permits Box, Box2 {}
record Box(L1 value) implements Boxed {}
record Box2(L1 value) implements Boxed {}
sealed interface L1 {}
final class L21 implements L1 {}
final class L22 implements L1 {}
class Test {
void foo(Pair<Box, Box> o) {
switch (o ) {
case Pair<Box, Box>(Box(L21 v1), Box(L22 v2)) -> {
}
case Pair<Box, Box>(Box b1, Box b2) -> {
}
}
}
}

View File

@@ -1,31 +0,0 @@
// "Create missing switch branch 'Pair<Boxed,Boxed>(Box b1, Box2 b2)'" "true-preview"
record Rec(L1 l1) {}
record Pair<T, K>(T b1, K b2) {}
sealed interface Boxed permits Box, Box2 {}
record Box(L1 value) implements Boxed {}
record Box2(L1 value) implements Boxed {}
sealed interface L1 {}
final class L21 implements L1 {}
final class L22 implements L1 {}
class Test {
void foo5(Pair<Boxed, Boxed> o) {
switch (o) {
case Pair<Boxed, Boxed>(Box(L21 v1), Box2(L22 v2)) -> {
}
case Pair<Boxed, Boxed>(Box(Object v1), Box(Object v2)) -> {
}
case Pair<Boxed, Boxed>(Box2 b1, Boxed b2) -> {
}
case Pair<Boxed, Boxed>(Box b1, Box2 b2) -> {
}
}
}
}

View File

@@ -1,34 +0,0 @@
// "Create missing switch branch 'PairString<Boxed>(Box2 t, String t2)'" "true-preview"
record Rec(L1 l1) {}
record Pair<T, K>(T b1, K b2) {}
sealed interface Boxed permits Box, Box2 {}
record Box(L1 value) implements Boxed {}
record Box2(L1 value) implements Boxed {}
sealed interface L1 {}
final class L21 implements L1 {}
final class L22 implements L1 {}
record PairString<T>(T t, String t2) { }
record StringPair<T>(String t2, T t) { }
class Test {
void foo4(PairString<Boxed> o) {
switch (o) {
case PairString<Boxed>(Box(L21 v1), String t) -> {
}
case PairString<Boxed>(Box(L22 v2), String t2) -> {
}
case PairString<Boxed>(Box2 t, String t2) -> {
}
}
}
}

View File

@@ -1,35 +0,0 @@
// "Create missing switch branch 'StringPair<Boxed>(String t2, Box t)'" "true-preview"
record Rec(L1 l1) {}
record Pair<T, K>(T b1, K b2) {}
sealed interface Boxed permits Box, Box2 {}
record Box(L1 value) implements Boxed {}
record Box2(L1 value) implements Boxed {}
sealed interface L1 {}
final class L21 implements L1 {}
final class L22 implements L1 {}
record PairString<T>(T t, String t2) { }
record StringPair<T>(String t2, T t) { }
class Test {
void foo5(StringPair<Boxed> o) {
switch (o) {
case StringPair<Boxed>(String t, Box(L21 v1)) -> {
}
case StringPair<Boxed>(String t2, Box2 t) -> {
}
case StringPair<Boxed>(String t2, Box t) -> {
}
}
}
}

View File

@@ -1,15 +0,0 @@
// "Create missing switch branch 'Pair<I>(C y, int x)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(T y, int x) {}
class Test {
void foo3(Pair<I> pair) {
switch (pair) {
case Pair<I>(D a, int f) ->{}
case Pair<I>(C y, int x) -> {
}
}
}
}

View File

@@ -1,15 +0,0 @@
// "Create missing switch branch 'Pair<I>(int x, C y)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(int x, T y) {}
class Test {
void foo3(Pair<I> pair) {
switch (pair) {
case Pair<I>(int f, D a) ->{}
case Pair<I>(int x, C y) -> {
}
}
}
}

View File

@@ -1,18 +0,0 @@
// "Create missing branches: 'Pair<I>(C x, C y)', and 'Pair<I>(D x, C y)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(T x, T y) {}
class Test {
void foo3(Pair<I> pair) {
switch (pair) {
case Pair<I>(D f, D a) ->{}
case Pair<I>(C f, D a) ->{}
case Pair<I>(C x, C y) -> {
}
case Pair<I>(D x, C y) -> {
}
}
}
}

View File

@@ -1,15 +0,0 @@
// "Create missing switch branch 'Pair<I>(C x, I y)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(T x, T y) {}
class Test {
void foo3(Pair<I> pair) {
switch (pair) {
case Pair<I>(D f, I a) ->{}
case Pair<I>(C x, I y) -> {
}
}
}
}

View File

@@ -1,19 +0,0 @@
// "Create missing branches: 'Pair<I>(C x, C y)', and 'Pair<I>(D x, C y)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(T x, T y) {}
class Test {
void foo3(Pair<I> pair) {
switch (pair) {
case Pair<I>(D f, D a) ->{}
case Pair<I>(C f, D a) ->{}
case Pair<I>(C x, C y) -> {
}
case Pair<I>(D x, C y) -> {
}
case null -> {}
}
}
}

View File

@@ -1,16 +0,0 @@
// "Create missing switch branch 'Pair<I>(I x, D y)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(T x, T y) {}
class Test {
void test(Pair<I> i) {
switch (i<caret>) {
case Pair<I>(I f, I s) when Math.random() > 0.5 -> {}
case Pair<I>(I f, I s) when Math.random() > 0.1 -> {}
case Pair<I>(I f, I s) when Math.random() > 0.5 -> {}
case Pair<I>(I f, C s) -> {}
}
}
}

View File

@@ -1,25 +0,0 @@
// "Create missing switch branch 'Pair<Box,Box>(Box b1, Box b2)'" "true-preview"
record Rec(L1 l1) {}
record Pair<T, K>(T b1, K b2) {}
sealed interface Boxed permits Box, Box2 {}
record Box(L1 value) implements Boxed {}
record Box2(L1 value) implements Boxed {}
sealed interface L1 {}
final class L21 implements L1 {}
final class L22 implements L1 {}
class Test {
void foo(Pair<Box, Box> o) {
switch (o<caret> ) {
case Pair<Box, Box>(Box(L21 v1), Box(L22 v2)) -> {
}
}
}
}

View File

@@ -1,29 +0,0 @@
// "Create missing switch branch 'Pair<Boxed,Boxed>(Box b1, Box2 b2)'" "true-preview"
record Rec(L1 l1) {}
record Pair<T, K>(T b1, K b2) {}
sealed interface Boxed permits Box, Box2 {}
record Box(L1 value) implements Boxed {}
record Box2(L1 value) implements Boxed {}
sealed interface L1 {}
final class L21 implements L1 {}
final class L22 implements L1 {}
class Test {
void foo5(Pair<Boxed, Boxed> o) {
switch (o<caret>) {
case Pair<Boxed, Boxed>(Box(L21 v1), Box2(L22 v2)) -> {
}
case Pair<Boxed, Boxed>(Box(Object v1), Box(Object v2)) -> {
}
case Pair<Boxed, Boxed>(Box2 b1, Boxed b2) -> {
}
}
}
}

View File

@@ -1,32 +0,0 @@
// "Create missing switch branch 'PairString<Boxed>(Box2 t, String t2)'" "true-preview"
record Rec(L1 l1) {}
record Pair<T, K>(T b1, K b2) {}
sealed interface Boxed permits Box, Box2 {}
record Box(L1 value) implements Boxed {}
record Box2(L1 value) implements Boxed {}
sealed interface L1 {}
final class L21 implements L1 {}
final class L22 implements L1 {}
record PairString<T>(T t, String t2) { }
record StringPair<T>(String t2, T t) { }
class Test {
void foo4(PairString<Boxed> o) {
switch (o<caret>) {
case PairString<Boxed>(Box(L21 v1), String t) -> {
}
case PairString<Boxed>(Box(L22 v2), String t2) -> {
}
}
}
}

View File

@@ -1,33 +0,0 @@
// "Create missing switch branch 'StringPair<Boxed>(String t2, Box t)'" "true-preview"
record Rec(L1 l1) {}
record Pair<T, K>(T b1, K b2) {}
sealed interface Boxed permits Box, Box2 {}
record Box(L1 value) implements Boxed {}
record Box2(L1 value) implements Boxed {}
sealed interface L1 {}
final class L21 implements L1 {}
final class L22 implements L1 {}
record PairString<T>(T t, String t2) { }
record StringPair<T>(String t2, T t) { }
class Test {
void foo5(StringPair<Boxed> o) {
switch (o<caret>) {
case StringPair<Boxed>(String t, Box(L21 v1)) -> {
}
case StringPair<Boxed>(String t2, Box2 t) -> {
}
}
}
}

View File

@@ -1,13 +0,0 @@
// "Create missing switch branch 'Pair<I>(C y, int x)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(T y, int x) {}
class Test {
void foo3(Pair<I> pair) {
switch (pair<caret>) {
case Pair<I>(D a, int f) ->{}
}
}
}

View File

@@ -1,13 +0,0 @@
// "Create missing switch branch 'Pair<I>(int x, C y)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(int x, T y) {}
class Test {
void foo3(Pair<I> pair) {
switch (pair<caret>) {
case Pair<I>(int f, D a) ->{}
}
}
}

View File

@@ -1,14 +0,0 @@
// "Create missing branches: 'Pair<I>(C x, C y)', and 'Pair<I>(D x, C y)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(T x, T y) {}
class Test {
void foo3(Pair<I> pair) {
switch (pair<caret>) {
case Pair<I>(D f, D a) ->{}
case Pair<I>(C f, D a) ->{}
}
}
}

View File

@@ -1,13 +0,0 @@
// "Create missing switch branch 'Pair<I>(C x, I y)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(T x, T y) {}
class Test {
void foo3(Pair<I> pair) {
switch (pair<caret>) {
case Pair<I>(D f, I a) ->{}
}
}
}

View File

@@ -1,15 +0,0 @@
// "Create missing branches: 'Pair<I>(C x, C y)', and 'Pair<I>(D x, C y)'" "true-preview"
sealed interface I permits C, D {}
final class C implements I {}
final class D implements I {}
record Pair<T>(T x, T y) {}
class Test {
void foo3(Pair<I> pair) {
switch (pair<caret>) {
case Pair<I>(D f, D a) ->{}
case Pair<I>(C f, D a) ->{}
case null -> {}
}
}
}

View File

@@ -1,12 +0,0 @@
// "Replace 'case default' with 'default'" "true-preview"
class Test {
void f() {
int o = 1;
switch (o) {
case 1:
System.out.println("2");
/*some text*/
default:
System.out.println("3") /*some text2*/;
}
}

View File

@@ -1,12 +0,0 @@
// "Replace 'case default' with 'default'" "true-preview"
class Test {
void f() {
Object o = null;
int o1 = 1;
switch (o1) {
case 1 -> System.out.println("2");
/*some text*/
default -> System.out.println("3") /*some text2*/;
}
}
}

View File

@@ -1,11 +0,0 @@
// "Replace 'case default' with 'default'" "true-preview"
class Test {
void f() {
int o = 1;
switch (o) {
case 1:
System.out.println("2");
case /*some text*/ de<caret>fault:
System.out.println("3") /*some text2*/;
}
}

View File

@@ -1,11 +0,0 @@
// "Replace 'case default' with 'default'" "true-preview"
class Test {
void f() {
Object o = null;
int o1 = 1;
switch (o1) {
case 1 -> System.out.println("2");
case /*some text*/ d<caret>efault -> System.out.println("3") /*some text2*/;
}
}
}