Update reproduction if issue with enums in annotations

Also test Proguard.

Bug: b/236691999
Change-Id: I8d23a6a083c27e30405e563a03987eaf0e6a52cb
diff --git a/src/test/java/com/android/tools/r8/shaking/enums/EnumArrayInAnnotationTest.java b/src/test/java/com/android/tools/r8/shaking/enums/EnumArrayInAnnotationTest.java
index 2fa8e6c..d0a0601 100644
--- a/src/test/java/com/android/tools/r8/shaking/enums/EnumArrayInAnnotationTest.java
+++ b/src/test/java/com/android/tools/r8/shaking/enums/EnumArrayInAnnotationTest.java
@@ -6,11 +6,11 @@
 
 import static org.junit.Assume.assumeTrue;
 
+import com.android.tools.r8.ProguardVersion;
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.TestParameters;
 import com.android.tools.r8.TestRuntime.CfVm;
 import com.android.tools.r8.TestShrinkerBuilder;
-import com.android.tools.r8.ToolHelper.DexVm;
 import com.android.tools.r8.utils.BooleanUtils;
 import com.android.tools.r8.utils.StringUtils;
 import java.lang.annotation.ElementType;
@@ -67,6 +67,7 @@
             builder -> {
               // Do nothing for DEX.
             })
+        .setMinApi(parameters.getApiLevel())
         .addKeepRuntimeVisibleAnnotations()
         .run(parameters.getRuntime(), Main.class)
         .applyIf(
@@ -78,9 +79,31 @@
                 && useGenericEnumsRule
                 && parameters.asCfRuntime().isNewerThanOrEqual(CfVm.JDK11),
             r -> r.assertFailureWithErrorThatThrows(EnumConstantNotPresentException.class),
-            parameters.isDexRuntime()
-                && parameters.asDexRuntime().getVm().isOlderThan(DexVm.ART_8_1_0_HOST),
-            r -> r.assertFailureWithErrorThatThrows(ClassNotFoundException.class),
+            r -> r.assertSuccessWithOutput(EXPECTED_RESULT));
+  }
+
+  @Test
+  public void testProguard() throws Exception {
+    assumeTrue(parameters.isCfRuntime());
+    testForProguard(ProguardVersion.V7_0_0)
+        .addInnerClasses(getClass())
+        .addKeepMainRule(Main.class)
+        .applyIf(
+            useGenericEnumsRule,
+            TestShrinkerBuilder::addKeepEnumsRule,
+            builder ->
+                builder.addKeepRules(
+                    "-keepclassmembernames enum "
+                        + EnumArrayInAnnotationTest.Enum.class.getTypeName()
+                        + " { <fields>; }"))
+        .addKeepRules("-dontwarn " + getClass().getTypeName())
+        .addKeepRuntimeVisibleAnnotations()
+        .run(parameters.getRuntime(), Main.class)
+        .applyIf(
+            !useGenericEnumsRule && parameters.asCfRuntime().isOlderThan(CfVm.JDK11),
+            r -> r.assertFailureWithErrorThatThrows(ArrayStoreException.class),
+            !useGenericEnumsRule && parameters.asCfRuntime().isNewerThanOrEqual(CfVm.JDK11),
+            r -> r.assertFailureWithErrorThatThrows(EnumConstantNotPresentException.class),
             r -> r.assertSuccessWithOutput(EXPECTED_RESULT));
   }
 
diff --git a/src/test/java/com/android/tools/r8/shaking/enums/EnumInAnnotationTest.java b/src/test/java/com/android/tools/r8/shaking/enums/EnumInAnnotationTest.java
index 62b972e..b17017c 100644
--- a/src/test/java/com/android/tools/r8/shaking/enums/EnumInAnnotationTest.java
+++ b/src/test/java/com/android/tools/r8/shaking/enums/EnumInAnnotationTest.java
@@ -6,6 +6,7 @@
 
 import static org.junit.Assume.assumeTrue;
 
+import com.android.tools.r8.ProguardVersion;
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.TestParameters;
 import com.android.tools.r8.TestShrinkerBuilder;
@@ -76,6 +77,28 @@
             r -> r.assertSuccessWithOutput(EXPECTED_RESULT));
   }
 
+  @Test
+  public void testProguard() throws Exception {
+    assumeTrue(parameters.isCfRuntime());
+    testForProguard(ProguardVersion.V7_0_0)
+        .addInnerClasses(EnumInAnnotationTest.class)
+        .addKeepMainRule(Main.class)
+        .addKeepEnumsRule()
+        .applyIf(
+            useGenericEnumsRule,
+            TestShrinkerBuilder::addKeepEnumsRule,
+            builder ->
+                builder.addKeepRules(
+                    "-keepclassmembernames class "
+                        + EnumInAnnotationTest.Enum.class.getTypeName()
+                        + " { <fields>; }"))
+        .addKeepRules("-dontwarn " + getClass().getTypeName())
+        .addKeepRuntimeVisibleAnnotations()
+        .compile()
+        .run(parameters.getRuntime(), Main.class)
+        .assertSuccessWithOutput(EXPECTED_RESULT);
+  }
+
   public enum Enum {
     TEST_ONE,
     TEST_TWO