25 * @test |
25 * @test |
26 * @bug 4110560 4785453 |
26 * @bug 4110560 4785453 |
27 * @summary portability : javac.properties |
27 * @summary portability : javac.properties |
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 * @build toolbox.ToolBox toolbox.JavacTask |
33 * @build ToolBox |
|
34 * @run main NewLineTest |
32 * @run main NewLineTest |
35 */ |
33 */ |
36 |
34 |
37 import java.io.File; |
35 import java.io.File; |
38 import java.nio.charset.Charset; |
36 import java.nio.charset.Charset; |
39 import java.nio.file.Files; |
37 import java.nio.file.Files; |
40 import java.util.List; |
38 import java.util.List; |
41 |
39 |
|
40 import toolbox.JavacTask; |
|
41 import toolbox.Task; |
|
42 import toolbox.ToolBox; |
|
43 |
42 //original test: test/tools/javac/newlines/Newlines.sh |
44 //original test: test/tools/javac/newlines/Newlines.sh |
43 public class NewLineTest { |
45 public class NewLineTest { |
44 |
46 |
45 public static void main(String args[]) throws Exception { |
47 public static void main(String args[]) throws Exception { |
46 ToolBox tb = new ToolBox(); |
48 ToolBox tb = new ToolBox(); |
47 File javacErrOutput = new File("output.txt"); |
49 File javacErrOutput = new File("output.txt"); |
48 tb.new JavacTask(ToolBox.Mode.EXEC) |
50 new JavacTask(tb, Task.Mode.EXEC) |
49 .redirect(ToolBox.OutputKind.STDERR, javacErrOutput.getPath()) |
51 .redirect(Task.OutputKind.STDERR, javacErrOutput.getPath()) |
50 .options("-J-Dline.separator='@'") |
52 .options("-J-Dline.separator='@'") |
51 .run(ToolBox.Expect.FAIL); |
53 .run(Task.Expect.FAIL); |
52 |
54 |
53 List<String> lines = Files.readAllLines(javacErrOutput.toPath(), |
55 List<String> lines = Files.readAllLines(javacErrOutput.toPath(), |
54 Charset.defaultCharset()); |
56 Charset.defaultCharset()); |
55 if (lines.size() != 1) { |
57 if (lines.size() != 1) { |
56 throw new AssertionError("The compiler output should have one line only"); |
58 throw new AssertionError("The compiler output should have one line only"); |