< prev index next >

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

Print this page

        

*** 28,37 **** --- 28,38 ---- * @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,53 **** --- 40,56 ---- * @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,156 **** * * 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"); // 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 --- 149,159 ---- * * 3) Verify the result of getElementsAnnotatedWithAny({X, Y}) is equal to * getElementsAnnotatedWith(X) UNION getElementsAnnotatedWith(Y). */ void checkSetOfAnnotatedElements(RoundEnvironment re) { ! 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,184 **** testNonAnnotations(re); // Verify AnnotatedElementInfo is present on the first // specified type. ! TypeElement firstType = typesIn(re.getRootElements()).iterator().next(); AnnotatedElementInfo annotatedElemInfo = ! firstType.getAnnotation(AnnotatedElementInfo.class); boolean failed = false; Objects.requireNonNull(annotatedElemInfo, ! "Missing AnnotatedElementInfo annotation on " + firstType); // Verify that the annotation information is as expected. Set<String> expectedNames = new HashSet<>(Arrays.asList(annotatedElemInfo.names())); --- 169,187 ---- testNonAnnotations(re); // Verify AnnotatedElementInfo is present on the first // specified type. ! Element firstElement = re.getRootElements().iterator().next(); AnnotatedElementInfo annotatedElemInfo = ! firstElement.getAnnotation(AnnotatedElementInfo.class); boolean failed = false; Objects.requireNonNull(annotatedElemInfo, ! "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 >