25 * @test |
25 * @test |
26 * @bug 4866831 |
26 * @bug 4866831 |
27 * @summary Verify that javap marks public interfaces as public |
27 * @summary Verify that javap marks public interfaces as public |
28 * @library /tools/lib |
28 * @library /tools/lib |
29 * @modules jdk.compiler/com.sun.tools.javac.api |
29 * @modules jdk.compiler/com.sun.tools.javac.api |
30 * jdk.compiler/com.sun.tools.javac.file |
|
31 * jdk.compiler/com.sun.tools.javac.main |
30 * jdk.compiler/com.sun.tools.javac.main |
32 * jdk.jdeps/com.sun.tools.javap |
31 * jdk.jdeps/com.sun.tools.javap |
33 * @build ToolBox |
32 * @build toolbox.ToolBox toolbox.JavapTask |
34 * @run main PublicInterfaceTest |
33 * @run main PublicInterfaceTest |
35 */ |
34 */ |
36 |
35 |
37 import java.nio.file.Path; |
36 import java.nio.file.Path; |
38 import java.nio.file.Paths; |
37 import java.nio.file.Paths; |
|
38 |
|
39 import toolbox.JavapTask; |
|
40 import toolbox.Task; |
|
41 import toolbox.ToolBox; |
39 |
42 |
40 // Original test: test/tools/javap/PublicInterfaceTest.sh |
43 // Original test: test/tools/javap/PublicInterfaceTest.sh |
41 public class PublicInterfaceTest { |
44 public class PublicInterfaceTest { |
42 public interface Test {} |
45 public interface Test {} |
43 |
46 |
44 public static void main(String[] args) throws Exception { |
47 public static void main(String[] args) throws Exception { |
45 ToolBox tb = new ToolBox(); |
48 ToolBox tb = new ToolBox(); |
46 |
49 |
47 Path pathToClass = Paths.get(ToolBox.testClasses, "PublicInterfaceTest$Test.class"); |
50 Path pathToClass = Paths.get(ToolBox.testClasses, "PublicInterfaceTest$Test.class"); |
48 |
51 |
49 String out = tb.new JavapTask() |
52 String out = new JavapTask(tb) |
50 .classes(pathToClass.toString()) |
53 .classes(pathToClass.toString()) |
51 .run() |
54 .run() |
52 .getOutput(ToolBox.OutputKind.DIRECT); |
55 .getOutput(Task.OutputKind.DIRECT); |
53 |
56 |
54 if (!out.contains("public")) |
57 if (!out.contains("public")) |
55 throw new AssertionError("The javap output does not contain \"public\""); |
58 throw new AssertionError("The javap output does not contain \"public\""); |
56 } |
59 } |
57 |
60 |