Update test 031 to track the libcore annotations implementation changes.
Change-Id: I22c6954dfff28d3c9a1faa193bc42b527a142f85
diff --git a/test/031-class-attributes/src/ClassAttrs.java b/test/031-class-attributes/src/ClassAttrs.java
index c1407bd..d4d4d0e 100644
--- a/test/031-class-attributes/src/ClassAttrs.java
+++ b/test/031-class-attributes/src/ClassAttrs.java
@@ -72,23 +72,16 @@
public static String getSignatureAttribute(Object obj) {
Method method;
try {
- if (obj instanceof AccessibleObject) {
- method = AccessibleObject.class.getDeclaredMethod(
- "getSignatureAttribute");
- } else {
- // Should be a Class.
- method = Class.class.getDeclaredMethod(
- "getSignatureAttribute");
- }
+ Class c = Class.forName("libcore.reflect.AnnotationAccess");
+ method = c.getDeclaredMethod("getSignature", java.lang.reflect.AnnotatedElement.class);
method.setAccessible(true);
- } catch (NoSuchMethodException ex) {
- System.err.println("getSignatureAttribute() not defined.");
+ } catch (Exception ex) {
ex.printStackTrace();
return "<unknown>";
}
try {
- return (String) method.invoke(obj);
+ return (String) method.invoke(null, obj);
} catch (IllegalAccessException ex) {
throw new RuntimeException(ex);
} catch (InvocationTargetException ex) {