1 /* |
1 /* |
2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
81 /** Doc comment: run */ |
81 /** Doc comment: run */ |
82 void run() throws Exception { |
82 void run() throws Exception { |
83 File testSrc = new File(System.getProperty("test.src")); |
83 File testSrc = new File(System.getProperty("test.src")); |
84 File thisFile = new File(testSrc, getClass().getName() + ".java"); |
84 File thisFile = new File(testSrc, getClass().getName() + ".java"); |
85 JavacTool javac = JavacTool.create(); |
85 JavacTool javac = JavacTool.create(); |
86 StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null); |
86 try (StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null)) { |
87 fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File("."))); |
87 fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File("."))); |
88 Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjects(thisFile); |
88 Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjects(thisFile); |
89 testAnnoProcessor(javac, fm, fos, out, EXPECT_DOC_COMMENTS); |
89 testAnnoProcessor(javac, fm, fos, out, EXPECT_DOC_COMMENTS); |
90 testTaskListener(javac, fm, fos, out, EXPECT_DOC_COMMENTS); |
90 testTaskListener(javac, fm, fos, out, EXPECT_DOC_COMMENTS); |
91 |
91 |
92 if (errors > 0) |
92 if (errors > 0) |
93 throw new Exception(errors + " errors occurred"); |
93 throw new Exception(errors + " errors occurred"); |
|
94 } |
94 } |
95 } |
95 |
96 |
96 void testAnnoProcessor(JavacTool javac, StandardJavaFileManager fm, |
97 void testAnnoProcessor(JavacTool javac, StandardJavaFileManager fm, |
97 Iterable<? extends JavaFileObject> files, PrintWriter out, |
98 Iterable<? extends JavaFileObject> files, PrintWriter out, |
98 int expectedDocComments) { |
99 int expectedDocComments) { |