1 /* |
1 /* |
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 2016, 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. |
26 * @bug 8006263 |
26 * @bug 8006263 |
27 * @summary Supplementary test cases needed for doclint |
27 * @summary Supplementary test cases needed for doclint |
28 * @library /tools/lib |
28 * @library /tools/lib |
29 * @modules jdk.compiler/com.sun.tools.doclint |
29 * @modules jdk.compiler/com.sun.tools.doclint |
30 * jdk.compiler/com.sun.tools.javac.api |
30 * jdk.compiler/com.sun.tools.javac.api |
31 * jdk.compiler/com.sun.tools.javac.file |
|
32 * jdk.compiler/com.sun.tools.javac.main |
31 * jdk.compiler/com.sun.tools.javac.main |
33 * jdk.compiler/com.sun.tools.javac.util |
32 * @build toolbox.ToolBox toolbox.JarTask |
34 * jdk.jdeps/com.sun.tools.javap |
|
35 * @build ToolBox |
|
36 * @run main PathsTest |
33 * @run main PathsTest |
37 */ |
34 */ |
38 |
35 |
39 import com.sun.tools.javac.util.Context; |
|
40 import com.sun.tools.javac.file.JavacFileManager; |
|
41 import com.sun.tools.doclint.DocLint; |
|
42 import com.sun.tools.doclint.DocLint.BadArgs; |
|
43 import java.io.File; |
36 import java.io.File; |
44 import java.io.FileWriter; |
37 import java.io.FileWriter; |
45 import java.io.IOException; |
38 import java.io.IOException; |
46 import java.io.PrintWriter; |
39 import java.io.PrintWriter; |
47 import java.io.StringWriter; |
40 import java.io.StringWriter; |
48 import java.util.regex.Pattern; |
41 import java.util.regex.Pattern; |
49 import javax.tools.StandardLocation; |
42 import javax.tools.StandardLocation; |
50 import javax.tools.JavaFileManager; |
43 import javax.tools.JavaFileManager; |
|
44 import javax.tools.ToolProvider; |
|
45 |
|
46 import com.sun.tools.doclint.DocLint; |
|
47 import com.sun.tools.doclint.DocLint.BadArgs; |
|
48 |
|
49 import toolbox.JarTask; |
|
50 import toolbox.ToolBox; |
51 |
51 |
52 public class PathsTest { |
52 public class PathsTest { |
53 public static void main(String... args) throws Exception { |
53 public static void main(String... args) throws Exception { |
54 new PathsTest().run(); |
54 new PathsTest().run(); |
55 } |
55 } |
115 } |
115 } |
116 } |
116 } |
117 |
117 |
118 File createJar() throws IOException { |
118 File createJar() throws IOException { |
119 File f = new File("test.jar"); |
119 File f = new File("test.jar"); |
120 try (JavaFileManager fm = new JavacFileManager(new Context(), false, null)) { |
120 try (JavaFileManager fm = ToolProvider.getSystemJavaCompiler() |
|
121 .getStandardFileManager(null, null, null)) { |
121 ToolBox tb = new ToolBox(); |
122 ToolBox tb = new ToolBox(); |
122 tb.new JarTask(f.getPath()) |
123 new JarTask(tb, f.getPath()) |
123 .files(fm, StandardLocation.PLATFORM_CLASS_PATH, "java.lang.*") |
124 .files(fm, StandardLocation.PLATFORM_CLASS_PATH, "java.lang.*") |
124 .run(); |
125 .run(); |
125 } |
126 } |
126 return f; |
127 return f; |
127 } |
128 } |