Fix host-only exception in art test 005-annotations.

This test involves a method which has an annotation which has an
enum-valued parameter, and the enum value supplied exists in the
version of the enum which is used at compile-time but not in the
version of the enum on the classpath. The test previously asserted
that calling java.lang.reflect.Method.getDeclaredAnnotations() should
throw java.lang.NoSuchFieldError. This matches the libcore+art
behaviour, so the test passes in --host mode. But it fails in --jvm
mode, as a java.lang.annotation.AnnotationFormatError is thrown there.

The javadoc doesn't strongly support an argument that one of these is
more correct than the other, and there's no reason to believe that
anyone is depending on one behaviour or the other. This change
therefore doesn't affect the behaviour of art+libcore, but makes the
test accept Error more generally.
(https://developer.android.com/reference/java/lang/reflect/AnnotatedElement)

This therefore stops the test throwing an exception in --jvm
mode. There are still differences between the expected and actual
output of the test, around e.g. whether string-valued parameters
should be quoted or not.

Bug: 73897123
Test: `art/test/run-test --jvm --dev 005-annotations` now completes successfully instead of failing with an exception
Test: `art/test/run-test --jvm 005-annotations` now shows output diff instead of failing with an exception
Test: `art/test/run-test --host 005-annotations` still passes
Change-Id: I11a8c0933555c513adb26b34015e4918025a05df
diff --git a/test/005-annotations/expected.txt b/test/005-annotations/expected.txt
index ee5b0c7..b537c8f 100644
--- a/test/005-annotations/expected.txt
+++ b/test/005-annotations/expected.txt
@@ -109,4 +109,4 @@
 
 Get annotation with missing class should not throw
 Got expected TypeNotPresentException
-Got expected NoSuchFieldError
+Got expected Error for renamed enum
diff --git a/test/005-annotations/src/android/test/anno/TestAnnotations.java b/test/005-annotations/src/android/test/anno/TestAnnotations.java
index 8ea8e8e..a3e32f9 100644
--- a/test/005-annotations/src/android/test/anno/TestAnnotations.java
+++ b/test/005-annotations/src/android/test/anno/TestAnnotations.java
@@ -17,6 +17,7 @@
 package android.test.anno;
 
 import java.lang.annotation.Annotation;
+import java.lang.annotation.AnnotationFormatError;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
@@ -241,8 +242,8 @@
                 Annotation[] annos = m.getDeclaredAnnotations();
                 System.out.println("  annotations on METH " + m + ":");
             }
-        } catch (NoSuchFieldError expected) {
-            System.out.println("Got expected NoSuchFieldError");
+        } catch (Error expected) {
+            System.out.println("Got expected Error for renamed enum");
         }
 
         // Test if annotations marked VISIBILITY_BUILD are visible to runtime in M and earlier.