665N/A/*
665N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
665N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
665N/A *
665N/A * This code is free software; you can redistribute it and/or modify it
665N/A * under the terms of the GNU General Public License version 2 only, as
665N/A * published by the Free Software Foundation.
665N/A *
665N/A * This code is distributed in the hope that it will be useful, but WITHOUT
665N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
665N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
665N/A * version 2 for more details (a copy is included in the LICENSE file that
665N/A * accompanied this code).
665N/A *
665N/A * You should have received a copy of the GNU General Public License version
665N/A * 2 along with this work; if not, write to the Free Software Foundation,
665N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
665N/A *
665N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
665N/A * or visit www.oracle.com if you need additional information or have any
665N/A * questions.
665N/A */
665N/A
665N/A/*
665N/A * @test
665N/A * @bug 6458749
665N/A * @summary TypeParameterElement.getEnclosedElements() throws NPE within javac
665N/A * @build T6458749
665N/A * @compile -processor T6458749 -proc:only T6458749.java
665N/A */
665N/A
665N/Aimport java.util.Set;
665N/Aimport javax.annotation.processing.*;
665N/Aimport javax.lang.model.element.*;
665N/Aimport javax.lang.model.util.ElementFilter;
665N/Aimport javax.lang.model.SourceVersion;
665N/A
665N/A@SupportedAnnotationTypes("*")
665N/Apublic class T6458749<T> extends AbstractProcessor {
665N/A public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
665N/A if (!renv.processingOver()) {
665N/A for(TypeElement e : ElementFilter.typesIn(renv.getRootElements())) {
665N/A System.out.printf("Element %s:%n", e.toString());
665N/A try {
665N/A for (TypeParameterElement tp : e.getTypeParameters()) {
665N/A System.out.printf("Type param %s", tp.toString());
665N/A if (! tp.getEnclosedElements().isEmpty()) {
665N/A throw new AssertionError("TypeParameterElement.getEnclosedElements() should return empty list");
665N/A }
665N/A }
665N/A } catch (NullPointerException npe) {
665N/A throw new AssertionError("NPE from TypeParameterElement.getEnclosedElements()", npe);
665N/A }
665N/A }
665N/A }
665N/A return true;
665N/A }
665N/A
665N/A public SourceVersion getSupportedSourceVersion() {
665N/A return SourceVersion.latest();
665N/A }
665N/A}