diff options
author | Elliott Hughes <enh@google.com> | 2011-10-06 13:41:44 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2011-10-06 13:41:44 -0700 |
commit | 32caed449e4f2ecd90ebb116a714df0ebcc537e9 (patch) | |
tree | 594fc125ba24aacdeb98729cdce7c5df4eca0a3e /test/031-class-attributes | |
parent | 8eb434f151dd04f23738f4dc7703eb156aa4acb9 (diff) | |
download | art-32caed449e4f2ecd90ebb116a714df0ebcc537e9.zip art-32caed449e4f2ecd90ebb116a714df0ebcc537e9.tar.gz art-32caed449e4f2ecd90ebb116a714df0ebcc537e9.tar.bz2 |
Update test 031 to track the libcore annotations implementation changes.
Change-Id: I22c6954dfff28d3c9a1faa193bc42b527a142f85
Diffstat (limited to 'test/031-class-attributes')
-rw-r--r-- | test/031-class-attributes/src/ClassAttrs.java | 15 |
1 files changed, 4 insertions, 11 deletions
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 class ClassAttrs { 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) { |