src/share/classes/com/sun/tools/javac/model/JavacElements.java

changeset 1492
df694c775e8a
parent 1491
9f42a06a49c0
child 1501
8b749558767b
     1.1 --- a/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Mon Jan 14 19:52:36 2013 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Mon Jan 14 13:50:01 2013 -0800
     1.3 @@ -261,13 +261,13 @@
     1.4      }
     1.5  
     1.6      // Needed to unpack the runtime view of containing annotations
     1.7 -    private static final Class<? extends Annotation> CONTAINED_BY_CLASS = initContainedBy();
     1.8 +    private static final Class<? extends Annotation> REPEATABLE_CLASS = initRepeatable();
     1.9      private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod();
    1.10  
    1.11 -    private static Class<? extends Annotation> initContainedBy() {
    1.12 +    private static Class<? extends Annotation> initRepeatable() {
    1.13          try {
    1.14 -            @SuppressWarnings("unchecked") // java.lang.annotation.ContainedBy extends Annotation by being an annotation type
    1.15 -            Class<? extends Annotation> c = (Class)Class.forName("java.lang.annotation.ContainedBy");
    1.16 +            @SuppressWarnings("unchecked") // java.lang.annotation.Repeatable extends Annotation by being an annotation type
    1.17 +            Class<? extends Annotation> c = (Class)Class.forName("java.lang.annotation.Repeatable");
    1.18              return c;
    1.19          } catch (ClassNotFoundException e) {
    1.20              return null;
    1.21 @@ -276,12 +276,12 @@
    1.22          }
    1.23      }
    1.24      private static Method initValueElementMethod() {
    1.25 -        if (CONTAINED_BY_CLASS == null)
    1.26 +        if (REPEATABLE_CLASS == null)
    1.27              return null;
    1.28  
    1.29          Method m = null;
    1.30          try {
    1.31 -            m = CONTAINED_BY_CLASS.getMethod("value");
    1.32 +            m = REPEATABLE_CLASS.getMethod("value");
    1.33              if (m != null)
    1.34                  m.setAccessible(true);
    1.35              return m;
    1.36 @@ -292,19 +292,19 @@
    1.37  
    1.38      // Helper to getAnnotations
    1.39      private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) {
    1.40 -        // Since we can not refer to java.lang.annotation.ContainedBy until we are
    1.41 -        // bootstrapping with java 8 we need to get the ContainedBy annotation using
    1.42 +        // Since we can not refer to java.lang.annotation.Repeatable until we are
    1.43 +        // bootstrapping with java 8 we need to get the Repeatable annotation using
    1.44          // reflective invocations instead of just using its type and element method.
    1.45 -        if (CONTAINED_BY_CLASS != null &&
    1.46 +        if (REPEATABLE_CLASS != null &&
    1.47              VALUE_ELEMENT_METHOD != null) {
    1.48 -            // Get the ContainedBy instance on the annotations declaration
    1.49 -            Annotation containedBy = (Annotation)annoType.getAnnotation(CONTAINED_BY_CLASS);
    1.50 -            if (containedBy != null) {
    1.51 +            // Get the Repeatable instance on the annotations declaration
    1.52 +            Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS);
    1.53 +            if (repeatable != null) {
    1.54                  try {
    1.55                      // Get the value element, it should be a class
    1.56                      // indicating the containing annotation type
    1.57                      @SuppressWarnings("unchecked")
    1.58 -                    Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(containedBy);
    1.59 +                    Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable);
    1.60                      if (containerType == null)
    1.61                          return null;
    1.62  

mercurial