Move pattern matching instanceof test to jdk17 module

Change-Id: I19c7339022398a45b061d2f035f7f784d7c5f332
diff --git a/src/test/examplesJava17/pattern_matching_for_instanceof/Main.java b/src/test/examplesJava17/pattern_matching_for_instanceof/Main.java
deleted file mode 100644
index 35a3632..0000000
--- a/src/test/examplesJava17/pattern_matching_for_instanceof/Main.java
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2021, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-package pattern_matching_for_instanceof;
-
-final class Main {
-  public static void main(String[] args) {
-    Object obj = "Hello, world!";
-    if (obj instanceof String s) {
-      System.out.println(s);
-    }
-  }
-}
diff --git a/src/test/java/com/android/tools/r8/java_language/pattern_matching_for_instenceof/PattternMatchingForInstanceOfTest.java b/src/test/examplesJava17/pattern_matching_for_instanceof/PatternMatchingForInstanceOfTest.java
similarity index 71%
rename from src/test/java/com/android/tools/r8/java_language/pattern_matching_for_instenceof/PattternMatchingForInstanceOfTest.java
rename to src/test/examplesJava17/pattern_matching_for_instanceof/PatternMatchingForInstanceOfTest.java
index 135fc1f..569336c 100644
--- a/src/test/java/com/android/tools/r8/java_language/pattern_matching_for_instenceof/PattternMatchingForInstanceOfTest.java
+++ b/src/test/examplesJava17/pattern_matching_for_instanceof/PatternMatchingForInstanceOfTest.java
@@ -2,16 +2,14 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-package com.android.tools.r8.java_language.pattern_matching_for_instenceof;
+package pattern_matching_for_instanceof;
 
 import com.android.tools.r8.R8TestBuilder;
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.TestParameters;
 import com.android.tools.r8.TestParametersCollection;
 import com.android.tools.r8.TestRuntime.CfVm;
-import com.android.tools.r8.examples.jdk17.PatternMatchingForInstanceof;
 import com.google.common.collect.ImmutableList;
-import java.nio.file.Path;
 import java.util.List;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -20,15 +18,12 @@
 import org.junit.runners.Parameterized.Parameters;
 
 @RunWith(Parameterized.class)
-public class PattternMatchingForInstanceOfTest extends TestBase {
+public class PatternMatchingForInstanceOfTest extends TestBase {
 
   @Parameter public TestParameters parameters;
 
   private static List<String> EXPECTED = ImmutableList.of("Hello, world!");
 
-  private static final Path JAR = PatternMatchingForInstanceof.jar();
-  private static final String MAIN = PatternMatchingForInstanceof.Main.typeName();
-
   @Parameters(name = "{0}")
   public static TestParametersCollection data() {
     return getTestParameters()
@@ -42,18 +37,18 @@
   public void testJvm() throws Exception {
     parameters.assumeJvmTestParameters();
     testForJvm(parameters)
-        .addRunClasspathFiles(JAR)
-        .run(parameters.getRuntime(), MAIN)
+        .addInnerClassesAndStrippedOuter(getClass())
+        .run(parameters.getRuntime(), Main.class)
         .assertSuccessWithOutputLines(EXPECTED);
   }
 
   @Test
   public void testD8() throws Exception {
     testForD8(parameters.getBackend())
-        .addProgramFiles(JAR)
+        .addInnerClassesAndStrippedOuter(getClass())
         .setMinApi(parameters)
         .compile()
-        .run(parameters.getRuntime(), MAIN)
+        .run(parameters.getRuntime(), Main.class)
         .assertSuccessWithOutputLines(EXPECTED);
   }
 
@@ -62,16 +57,25 @@
     parameters.assumeR8TestParameters();
     R8TestBuilder<?, ?, ?> builder =
         testForR8(parameters.getBackend())
-            .addProgramFiles(JAR)
+            .addInnerClassesAndStrippedOuter(getClass())
             .setMinApi(parameters)
-            .addKeepMainRule(MAIN);
+            .addKeepMainRule(Main.class);
     if (parameters.getBackend().isDex()) {
-      builder.run(parameters.getRuntime(), MAIN).assertSuccessWithOutputLines(EXPECTED);
+      builder.run(parameters.getRuntime(), Main.class).assertSuccessWithOutputLines(EXPECTED);
     } else {
       testForJvm(parameters)
           .addRunClasspathFiles(builder.compile().writeToZip())
-          .run(parameters.getRuntime(), MAIN)
+          .run(parameters.getRuntime(), Main.class)
           .assertSuccessWithOutputLines(EXPECTED);
     }
   }
+
+  public static final class Main {
+    public static void main(String[] args) {
+      Object obj = "Hello, world!";
+      if (obj instanceof String s) {
+        System.out.println(s);
+      }
+    }
+  }
 }
diff --git a/src/test/java/com/android/tools/r8/examples/jdk17/PatternMatchingForInstanceof.java b/src/test/java/com/android/tools/r8/examples/jdk17/PatternMatchingForInstanceof.java
deleted file mode 100644
index ec5f4cd..0000000
--- a/src/test/java/com/android/tools/r8/examples/jdk17/PatternMatchingForInstanceof.java
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2021, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-package com.android.tools.r8.examples.jdk17;
-
-import com.android.tools.r8.examples.JavaExampleClassProxy;
-import java.nio.file.Path;
-
-public class PatternMatchingForInstanceof {
-
-  private static final String EXAMPLE_FILE = "examplesJava17/pattern_matching_for_instanceof";
-
-  public static final JavaExampleClassProxy Main =
-      new JavaExampleClassProxy(EXAMPLE_FILE, "pattern_matching_for_instanceof/Main");
-
-  public static Path jar() {
-    return JavaExampleClassProxy.examplesJar(EXAMPLE_FILE);
-  }
-}
diff --git a/src/test/java/com/android/tools/r8/examples/jdk17/Records.java b/src/test/java/com/android/tools/r8/examples/jdk17/Records.java
deleted file mode 100644
index aa4581e..0000000
--- a/src/test/java/com/android/tools/r8/examples/jdk17/Records.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2020, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-package com.android.tools.r8.examples.jdk17;
-
-import com.android.tools.r8.examples.JavaExampleClassProxy;
-import java.nio.file.Path;
-
-public class Records {
-
-  private static final String EXAMPLE_FILE = "examplesJava17/records";
-
-  public static final JavaExampleClassProxy Main =
-      new JavaExampleClassProxy(EXAMPLE_FILE, "records/Main");
-  public static final JavaExampleClassProxy Main$Person =
-      new JavaExampleClassProxy(EXAMPLE_FILE, "records/Main$Person");
-
-  public static Path jar() {
-    return JavaExampleClassProxy.examplesJar(EXAMPLE_FILE);
-  }
-}