TestAnonClassNames.java revision 721
553N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 514N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 514N/A * This code is free software; you can redistribute it and/or modify it 514N/A * under the terms of the GNU General Public License version 2 only, as 514N/A * published by the Free Software Foundation. 514N/A * This code is distributed in the hope that it will be useful, but WITHOUT 514N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 514N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 514N/A * version 2 for more details (a copy is included in the LICENSE file that 514N/A * accompanied this code). 514N/A * You should have received a copy of the GNU General Public License version 514N/A * 2 along with this work; if not, write to the Free Software Foundation, 514N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 553N/A * or visit www.oracle.com if you need additional information or have any 514N/A * @summary Test that reported names of anonymous classes are non-null. 514N/A * @author Joseph D. Darcy 698N/A * @library ../../../lib 698N/A * @build JavacTestingAbstractProcessor TestAnonSourceNames 514N/A * @run main TestAnonClassNames 514N/A * This test operates in phases to test retrieving the qualified name 514N/A * of anonymous classes from type elements modeling the anonymous 514N/A * class. The type elements are generated using both source files and 514N/A * class files as the basis of constructing the elements. 514N/A * Source files will be tested by the @compile line which runs 514N/A * TestAnonSourceNames as an annotation processor over this file. 514N/A * Class files are tested by the @run command on this type. This 514N/A * class gets the names of classes with different nesting kinds, 514N/A * including anonymous classes, and then invokes the compiler with an 514N/A * annotation processor having the class files names as inputs. The 514N/A * compiler is invoked via the javax.tools mechanism. 514N/A return "I have no name!";
514N/A * Perform annotation processing on the class file name and verify 514N/A * the existence of different flavors of class names when the 514N/A * input classes are modeled as elements. 514N/A * Probe at the various kinds of names of a type element. 514N/A // Verify different names are non-null; an NPE will 514N/A // result in failed compile status being reported.