langtools/test/tools/javac/T6406771.java
changeset 27319 030080f03e4f
parent 4935 ff8adaa7bb8e
child 30730 d3ce7619db2c
equal deleted inserted replaced
27318:4660a5da7d90 27319:030080f03e4f
    31                    "col:20",              "col:43" // this line uses a mixture
    31                    "col:20",              "col:43" // this line uses a mixture
    32     };
    32     };
    33 
    33 
    34     // White-space after this point does not matter
    34     // White-space after this point does not matter
    35 
    35 
    36     public static void main(String[] args) {
    36     public static void main(String[] args) throws IOException {
    37         String self = T6406771.class.getName();
    37         String self = T6406771.class.getName();
    38         String testSrc = System.getProperty("test.src");
    38         String testSrc = System.getProperty("test.src");
    39         String testClasses = System.getProperty("test.classes");
    39         String testClasses = System.getProperty("test.classes");
    40 
    40 
    41         JavacTool tool = JavacTool.create();
    41         JavacTool tool = JavacTool.create();
    42         StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
    42         try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
    43         JavaFileObject f = fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, self+".java"))).iterator().next();
    43             JavaFileObject f = fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, self+".java"))).iterator().next();
    44 
    44 
    45         List<String> opts = Arrays.asList("-d", ".", "-processorpath", testClasses, "-processor", self, "-proc:only");
    45             List<String> opts = Arrays.asList("-d", ".", "-processorpath", testClasses, "-processor", self, "-proc:only");
    46 
    46 
    47         JavacTask task = tool.getTask(null, fm, null, opts, null, Arrays.asList(f));
    47             JavacTask task = tool.getTask(null, fm, null, opts, null, Arrays.asList(f));
    48 
    48 
    49         if (!task.call())
    49             if (!task.call())
    50             throw new AssertionError("failed");
    50                 throw new AssertionError("failed");
       
    51         }
    51     }
    52     }
    52 
    53 
    53     public boolean process(Set<? extends TypeElement> elems, RoundEnvironment rEnv) {
    54     public boolean process(Set<? extends TypeElement> elems, RoundEnvironment rEnv) {
    54         final String LINE = "line" + ':';   // avoid matching this string
    55         final String LINE = "line" + ':';   // avoid matching this string
    55         final String COLUMN  = "col" + ':';
    56         final String COLUMN  = "col" + ':';