1301N/A * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 482N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 482N/A * This code is free software; you can redistribute it and/or modify it 482N/A * under the terms of the GNU General Public License version 2 only, as 482N/A * published by the Free Software Foundation. 482N/A * This code is distributed in the hope that it will be useful, but WITHOUT 482N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 482N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 482N/A * version 2 for more details (a copy is included in the LICENSE file that 482N/A * accompanied this code). 482N/A * You should have received a copy of the GNU General Public License version 482N/A * 2 along with this work; if not, write to the Free Software Foundation, 482N/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 482N/A * The test exercises different ways of providing annotations for a package. 482N/A * Each way provides an annotation with a unique argument. For each test 482N/A * case, the test verifies that the annotation with the correct argument is 482N/A * found by the compiler. 482N/A // Used to describe properties of files to be put on command line, source path, class path 482N/A /** File is not used. */ 482N/A * other path of type OLD, in which case, this file must be newer than the other one. */ 482N/A * location, in which case, this file will be generated by the annotation processor. */ 482N/A // if no args given, all test cases are run 482N/A // if args given, they indicate the test cases to be run 482N/A // Run tests for all combinations of files on command line, source path and class path. 482N/A // Invalid combinations are skipped in the test method 482N/A // uncomment to stop on first failed test case 482N/A /** One time setup for files and directories to be used in the various test cases. */ 482N/A // Annotation used in test cases to annotate package. This file is 482N/A // given on the command line in test cases. 482N/A // Compile the annotation for use later in setup 482N/A // package-info file to use on the command line when requied 482N/A // source path containing package-info 482N/A // class path containing package-info 482N/A // source path containing package-info which is newer than the one in cp-old 482N/A // class path containing package-info which is newer than the one in sp-old 482N/A // directory containing package-info.class to be "generated" later by annotation processor 482N/A // if test cases specified, skip this test case if not selected 482N/A // test specific tmp directory 482N/A // build up list of options and files to be compiled 482N/A // expected value for annotation 482N/A //opts.add("-verbose"); 482N/A * Analyze each of cl, cp, sp, building up the options and files to 482N/A * be compiled, and determining the expected outcome fo the test case. 482N/A // command line file: either omitted or given 482N/A // command line files always supercede files on paths 482N/A // pass expected value to annotation processor 482N/A // compile the files with the options that have been built up 482N/A * Return true if this combination of parameters does not identify a useful test case. 482N/A // skip if no package files required 482N/A // skip if both sp and sp are OLD, since results may be indeterminate 482N/A // skip if sp or cp is NEW but the other is not OLD 482N/A // only use GEN if no other package-info files present 482N/A // remaining combinations are valid 482N/A /** Write a file with a given body. */ 482N/A /** Write a file with a given body, ensuring that the file is newer than a reference file. */ 482N/A for (
int i =
0; i <
5; i++) {
482N/A /** Compile a file to a given directory, with options provided. */ 482N/A /** Compile files with options provided. */ 482N/A /** Report an error. */ 482N/A /** Test case counter. */ 482N/A /** Number of errors found. */ 482N/A /** Optional set of test cases to be run; empty implies all test cases. */ 482N/A /* Files created by setup. */ 482N/A /** Annotation processor used to verify the expected value for the 482N/A package annotations found by javac. */ 482N/A // if this is the first round and the gen option is given, use the filer to create 482N/A // a copy of the file specified by the gen option. 482N/A // if annotation processing is complete, verify the package annotation 482N/A // found by the compiler. 482N/A /** Get an option given to the annotation processor. */ 482N/A /** Check two strings are equal, and report an error if they are not. */ 482N/A /** Report an error to the annotation processing system. */