9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 6507179
27 * @summary Ensure that "-source" option isn't ignored.
28 * @author Scott Seligman
29 */
30
31 import com.sun.javadoc.*;
32
33 public class SourceOption extends Doclet {
34
35 public static void main(String[] args) {
36 if (com.sun.tools.javadoc.Main.execute(
37 "javadoc",
38 "SourceOption",
39 SourceOption.class.getClassLoader(),
40 new String[] {"-source", "1.3", "p"}) != 0)
41 throw new Error("Javadoc encountered warnings or errors.");
42 }
43
44 public static boolean start(RootDoc root) {
45 root.classes(); // force parser into action
46 return true;
47 }
48 }
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 6507179
27 * @summary Ensure that "-source" option isn't ignored.
28 * @author Scott Seligman
29 * @run main/fail SourceOption
30 */
31
32 /*
33 * TEST NOTE
34 * With JDK9, this this test has been transformed into a NEGATIVE test.
35 *
36 * Generally speaking, this test should check a feature not in at least
37 * one of the currently supported previous versions. In this manner,
38 * a failure of the -source option to be honored would mean a pass of
39 * the test, and therefore a failure of the -source option.
40 *
41 * For JDK9 and JDK10, both support 1.7, which did not support javac's
42 * lambda construct. So we set "-source 1.7" to compile a .java file
43 * containing the lambda construct. javac should fail, thus showing
44 * -source to be working. Thus the test passes.
45 *
46 * fixVersion: JDK11
47 * replace ./p/LambdaConstructTest.java with a missing from
48 * JDK8, JDK9, or JDK10. Set -source below appropriately.
49 */
50
51 import com.sun.javadoc.*;
52
53 public class SourceOption extends Doclet {
54
55 public static void main(String[] args) {
56 if (com.sun.tools.javadoc.Main.execute(
57 "javadoc",
58 "SourceOption",
59 SourceOption.class.getClassLoader(),
60 new String[] {"-source", "1.7", "p"}) != 0)
61 throw new Error("Javadoc encountered warnings or errors.");
62 }
63
64 public static boolean start(RootDoc root) {
65 root.classes(); // force parser into action
66 return true;
67 }
68 }
69
|