< prev index next >

test/langtools/tools/javac/diags/CheckExamples.java

Print this page

 28  * @modules jdk.compiler/com.sun.tools.javac.api
 29  *          jdk.compiler/com.sun.tools.javac.file
 30  *          jdk.compiler/com.sun.tools.javac.main
 31  *          jdk.compiler/com.sun.tools.javac.resources:open
 32  *          jdk.compiler/com.sun.tools.javac.util
 33  * @build Example CheckExamples DocCommentProcessor
 34  * @run main/othervm CheckExamples
 35  */
 36 
 37 /*
 38  *      See CR 7127924 for info on why othervm is used.
 39  */
 40 
 41 import java.io.*;
 42 import java.nio.file.*;
 43 import java.nio.file.attribute.BasicFileAttributes;
 44 import java.util.*;
 45 
 46 /**
 47  * Check invariants for a set of examples.





 48  * -- each example should exactly declare the keys that will be generated when
 49  *      it is run.

 50  * -- together, the examples should cover the set of resource keys in the
 51  *      compiler.properties bundle. A list of exceptions may be given in the
 52  *      not-yet.txt file. Entries on the not-yet.txt list should not be
 53  *      covered by examples.




 54  * When new keys are added to the resource bundle, it is strongly recommended
 55  * that corresponding new examples be added here, if at all practical, instead
 56  * of simply and lazily being added to the not-yet.txt list.
 57  */
 58 public class CheckExamples {
 59     /**
 60      * Standard entry point.
 61      */
 62     public static void main(String... args) throws Exception {
 63         boolean jtreg = (System.getProperty("test.src") != null);
 64         Path tmpDir;
 65         boolean deleteOnExit;
 66         if (jtreg) {
 67             // use standard jtreg scratch directory: the current directory
 68             tmpDir = Paths.get(System.getProperty("user.dir"));
 69             deleteOnExit = false;
 70         } else {
 71             tmpDir = Files.createTempDirectory(Paths.get(System.getProperty("java.io.tmpdir")),
 72                     CheckExamples.class.getName());
 73             deleteOnExit = true;

 28  * @modules jdk.compiler/com.sun.tools.javac.api
 29  *          jdk.compiler/com.sun.tools.javac.file
 30  *          jdk.compiler/com.sun.tools.javac.main
 31  *          jdk.compiler/com.sun.tools.javac.resources:open
 32  *          jdk.compiler/com.sun.tools.javac.util
 33  * @build Example CheckExamples DocCommentProcessor
 34  * @run main/othervm CheckExamples
 35  */
 36 
 37 /*
 38  *      See CR 7127924 for info on why othervm is used.
 39  */
 40 
 41 import java.io.*;
 42 import java.nio.file.*;
 43 import java.nio.file.attribute.BasicFileAttributes;
 44 import java.util.*;
 45 
 46 /**
 47  * Check invariants for a set of examples.
 48  *
 49  * READ THIS IF THIS TEST FAILS AFTER ADDING A NEW KEY TO 'compiler.properties':
 50  * The 'examples' subdirectory contains a number of examples which provoke
 51  * the reporting of most of the compiler message keys.
 52  *
 53  * -- each example should exactly declare the keys that will be generated when
 54  *      it is run.
 55  * -- this is done by the "// key:"-comment in each fine.
 56  * -- together, the examples should cover the set of resource keys in the
 57  *      compiler.properties bundle. A list of exceptions may be given in the
 58  *      not-yet.txt file. Entries on the not-yet.txt list should not be
 59  *      covered by examples.
 60  * -- some keys are only reported by the compiler when specific options are
 61  *      supplied. For the purposes of this test, this can be specified by a
 62  *      comment e.g. like this: "// options: -Xlint:empty"
 63  *
 64  * When new keys are added to the resource bundle, it is strongly recommended
 65  * that corresponding new examples be added here, if at all practical, instead
 66  * of simply and lazily being added to the not-yet.txt list.
 67  */
 68 public class CheckExamples {
 69     /**
 70      * Standard entry point.
 71      */
 72     public static void main(String... args) throws Exception {
 73         boolean jtreg = (System.getProperty("test.src") != null);
 74         Path tmpDir;
 75         boolean deleteOnExit;
 76         if (jtreg) {
 77             // use standard jtreg scratch directory: the current directory
 78             tmpDir = Paths.get(System.getProperty("user.dir"));
 79             deleteOnExit = false;
 80         } else {
 81             tmpDir = Files.createTempDirectory(Paths.get(System.getProperty("java.io.tmpdir")),
 82                     CheckExamples.class.getName());
 83             deleteOnExit = true;
< prev index next >