/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854
* @summary Tests that getElementsAnnotatedWith works properly.
* @author Joseph D. Darcy
* @library ../../../lib
* @build JavacTestingAbstractProcessor
* @compile TestElementsAnnotatedWith.java
* @compile InheritedAnnotation.java
* @compile -processor TestElementsAnnotatedWith -proc:only SurfaceAnnotations.java
* @compile -processor TestElementsAnnotatedWith -proc:only BuriedAnnotations.java
* @compile -processor TestElementsAnnotatedWith -proc:only Part1.java Part2.java
* @compile -processor TestElementsAnnotatedWith -proc:only C2.java
* @compile -processor TestElementsAnnotatedWith -proc:only Foo.java
* @compile Foo.java
*/
/**
* This processor verifies that the information returned by
* getElementsAnnotatedWith is consistent with the expected results
* stored in an AnnotatedElementInfo annotation.
*/
if (!roundEnvironment.processingOver()) {
// Verify AnnotatedElementInfo is present on the first
// specified type.
boolean failed = false;
if (annotatedElementInfo == null)
throw new IllegalArgumentException("Missing AnnotatedElementInfo annotation on " +
else {
// Verify that the annotation information is as
// expected.
failed = true;
} else {
failed = true;
}
}
}
}
failed = true;
"\nbase: " + resultsBase);
}
if (failed) {
throw new RuntimeException();
}
} else {
// If processing is over without an error, the specified
// elements should be empty so an empty set should be returned.
if (!resultsMeta.isEmpty())
if (!resultsBase.isEmpty())
}
return true;
}
try {
return roundEnvironment.
} catch(ClassNotFoundException cnfe) {
throw new RuntimeException(cnfe);
}
}
/**
* Verify non-annotation types result in
* IllegalArgumentExceptions.
*/
try {
throw new RuntimeException("Illegal argument exception not thrown");
} catch(IllegalArgumentException iae) {}
try {
getTypeElement("java.lang.Object") );
throw new RuntimeException("Illegal argument exception not thrown");
} catch(IllegalArgumentException iae) {}
}
}