< prev index next >

test/langtools/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java

Print this page

        

@@ -28,10 +28,11 @@
  * @author  Joseph D. Darcy
  * @library /tools/javac/lib
  * @modules java.compiler
  *          jdk.compiler
  * @build   JavacTestingAbstractProcessor
+ * @compile annot/AnnotatedElementInfo.java annot/MarkerAnnot.java
  * @compile TestElementsAnnotatedWith.java
  * @compile InheritedAnnotation.java
  * @compile TpAnno.java
  * @compile Anno.java
  * @compile -processor TestElementsAnnotatedWith -proc:only SurfaceAnnotations.java

@@ -39,15 +40,17 @@
  * @compile -processor TestElementsAnnotatedWith -proc:only Part1.java Part2.java
  * @compile -processor TestElementsAnnotatedWith -proc:only C2.java
  * @compile -processor TestElementsAnnotatedWith -proc:only Foo.java
  * @compile -processor TestElementsAnnotatedWith -proc:only TypeParameterAnnotations.java
  * @compile -processor TestElementsAnnotatedWith -proc:only ParameterAnnotations.java
+ * @compile -processor TestElementsAnnotatedWith -proc:only pkg/package-info.java
  * @compile/fail/ref=ErroneousAnnotations.out -processor TestElementsAnnotatedWith -proc:only -XDrawDiagnostics ErroneousAnnotations.java
  * @compile Foo.java
  * @compile/process -processor TestElementsAnnotatedWith -proc:only Foo
  */
 
+import annot.AnnotatedElementInfo;
 import java.lang.annotation.Annotation;
 import java.util.Collections;
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Arrays;

@@ -146,11 +149,11 @@
      *
      * 3) Verify the result of getElementsAnnotatedWithAny({X, Y}) is equal to
      * getElementsAnnotatedWith(X) UNION getElementsAnnotatedWith(Y).
      */
     void checkSetOfAnnotatedElements(RoundEnvironment re) {
-        TypeElement annotatedElemInfoElem =  elements.getTypeElement("AnnotatedElementInfo");
+        TypeElement annotatedElemInfoElem =  elements.getTypeElement("annot.AnnotatedElementInfo");
 
         // For the "Any" methods, search for both the expected
         // annotation and AnnotatedElementInfo and verify the return
         // set is the union of searching for AnnotatedElementInfo and
         // the other annotation

@@ -166,19 +169,19 @@
             testNonAnnotations(re);
 
             // Verify AnnotatedElementInfo is present on the first
             // specified type.
 
-            TypeElement firstType = typesIn(re.getRootElements()).iterator().next();
+            Element firstElement = re.getRootElements().iterator().next();
 
             AnnotatedElementInfo annotatedElemInfo =
-                firstType.getAnnotation(AnnotatedElementInfo.class);
+                firstElement.getAnnotation(AnnotatedElementInfo.class);
 
             boolean failed = false;
 
             Objects.requireNonNull(annotatedElemInfo,
-                                   "Missing AnnotatedElementInfo annotation on " + firstType);
+                                   "Missing AnnotatedElementInfo annotation on " + firstElement);
 
             // Verify that the annotation information is as expected.
             Set<String> expectedNames =
                 new HashSet<>(Arrays.asList(annotatedElemInfo.names()));
 
< prev index next >