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. |
25 * @test |
25 * @test |
26 * @bug 8009640 |
26 * @bug 8009640 |
27 * @summary -profile <compact> does not work when -bootclasspath specified |
27 * @summary -profile <compact> does not work when -bootclasspath specified |
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.compiler/com.sun.tools.javac.util |
31 * jdk.compiler/com.sun.tools.javac.util |
33 * jdk.jdeps/com.sun.tools.javap |
32 * jdk.jdeps/com.sun.tools.javap |
34 * @build ToolBox |
33 * @build toolbox.ToolBox toolbox.JavacTask |
35 * @run main CheckRejectProfileBCPOptionsIfUsedTogetherTest |
34 * @run main CheckRejectProfileBCPOptionsIfUsedTogetherTest |
36 */ |
35 */ |
37 |
36 |
|
37 import java.nio.file.Paths; |
|
38 |
38 import com.sun.tools.javac.util.Assert; |
39 import com.sun.tools.javac.util.Assert; |
39 import java.nio.file.Paths; |
40 |
|
41 import toolbox.JavacTask; |
|
42 import toolbox.Task; |
|
43 import toolbox.ToolBox; |
40 |
44 |
41 public class CheckRejectProfileBCPOptionsIfUsedTogetherTest { |
45 public class CheckRejectProfileBCPOptionsIfUsedTogetherTest { |
42 |
46 |
43 private static final String TestSrc = |
47 private static final String TestSrc = |
44 "public class Test {\n" + |
48 "public class Test {\n" + |
47 |
51 |
48 public static void main(String args[]) throws Exception { |
52 public static void main(String args[]) throws Exception { |
49 ToolBox tb = new ToolBox(); |
53 ToolBox tb = new ToolBox(); |
50 tb.writeFile("Test.java", TestSrc); |
54 tb.writeFile("Test.java", TestSrc); |
51 |
55 |
52 ToolBox.Result result = tb.new JavacTask(ToolBox.Mode.CMDLINE) |
56 Task.Result result = new JavacTask(tb, Task.Mode.CMDLINE) |
53 .options("-profile", "compact1", |
57 .options("-profile", "compact1", |
54 "-bootclasspath", Paths.get(ToolBox.testJDK, "jre/lib/rt.jar").toString()) |
58 "-bootclasspath", Paths.get(ToolBox.testJDK, "jre/lib/rt.jar").toString()) |
55 .files("Test.java") |
59 .files("Test.java") |
56 .run(ToolBox.Expect.FAIL) |
60 .run(Task.Expect.FAIL) |
57 .writeAll(); |
61 .writeAll(); |
58 |
62 |
59 String out = result.getOutput(ToolBox.OutputKind.DIRECT); |
63 String out = result.getOutput(Task.OutputKind.DIRECT); |
60 Assert.check(out.startsWith( |
64 Assert.check(out.startsWith( |
61 "javac: profile and bootclasspath options cannot be used together"), |
65 "javac: profile and bootclasspath options cannot be used together"), |
62 "Incorrect javac error output"); |
66 "Incorrect javac error output"); |
63 } |
67 } |
64 |
68 |