--- old/src/jdk.compiler/share/classes/com/sun/tools/javac/code/AnnoConstruct.java 2015-01-09 20:36:10.051563000 -0800 +++ new/src/jdk.compiler/share/classes/com/sun/tools/javac/code/AnnoConstruct.java 2015-01-09 20:36:09.879563000 -0800 @@ -26,6 +26,7 @@ import java.lang.annotation.Annotation; import java.lang.annotation.Inherited; +import java.lang.annotation.Repeatable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -183,65 +184,11 @@ return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType); } - // Needed to unpack the runtime view of containing annotations - private static final Class REPEATABLE_CLASS = initRepeatable(); - private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod(); - - private static Class initRepeatable() { - try { - // Repeatable will not be available when bootstrapping on - // JDK 7 so use a reflective lookup instead of a class - // literal for Repeatable.class. - return Class.forName("java.lang.annotation.Repeatable").asSubclass(Annotation.class); - } catch (ClassNotFoundException | SecurityException e) { - return null; - } - } - - private static Method initValueElementMethod() { - if (REPEATABLE_CLASS == null) - return null; - - Method m = null; - try { - m = REPEATABLE_CLASS.getMethod("value"); - if (m != null) - m.setAccessible(true); - return m; - } catch (NoSuchMethodException e) { - return null; - } - } - - // Helper to getAnnotationsByType private static Class getContainer(Class annoType) { - // Since we can not refer to java.lang.annotation.Repeatable until we are - // bootstrapping with java 8 we need to get the Repeatable annotation using - // reflective invocations instead of just using its type and element method. - if (REPEATABLE_CLASS != null && - VALUE_ELEMENT_METHOD != null) { - // Get the Repeatable instance on the annotations declaration - Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS); - if (repeatable != null) { - try { - // Get the value element, it should be a class - // indicating the containing annotation type - @SuppressWarnings("unchecked") - Class containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable); - if (containerType == null) - return null; - - return containerType; - } catch (ClassCastException | IllegalAccessException | InvocationTargetException e) { - return null; - } - } - } - return null; + return annoType.getAnnotation(Repeatable.class).value(); } - // Helper to getAnnotationsByType private static Attribute[] unpackAttributes(Attribute.Compound container) { // We now have an instance of the container,