langtools/test/tools/javac/T8009640/CheckRejectProfileBCPOptionsIfUsedTogetherTest.java
author alundblad
Wed, 26 Aug 2015 09:02:02 +0200
changeset 32337 c9d3ab9f601c
parent 30730 d3ce7619db2c
child 36526 3b41f1c69604
permissions -rw-r--r--
8133671: langtools tests have bad license Summary: Dropped classpath exception from copyright notice in tests. Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19489
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26264
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
19489
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
     4
 *
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
32337
c9d3ab9f601c 8133671: langtools tests have bad license
alundblad
parents: 30730
diff changeset
     7
 * published by the Free Software Foundation.
19489
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
     8
 *
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    13
 * accompanied this code).
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    14
 *
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    18
 *
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    21
 * questions.
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    22
 */
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    23
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    24
/*
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    25
 * @test
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    26
 * @bug 8009640
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    27
 * @summary -profile <compact> does not work when -bootclasspath specified
26100
bb7dd001d190 8050429: Update/cleanup ToolBox
jjg
parents: 19489
diff changeset
    28
 * @library /tools/lib
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26264
diff changeset
    29
 * @modules jdk.compiler/com.sun.tools.javac.api
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26264
diff changeset
    30
 *          jdk.compiler/com.sun.tools.javac.file
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26264
diff changeset
    31
 *          jdk.compiler/com.sun.tools.javac.main
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26264
diff changeset
    32
 *          jdk.compiler/com.sun.tools.javac.util
19489
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    33
 * @build ToolBox
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    34
 * @run main CheckRejectProfileBCPOptionsIfUsedTogetherTest
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    35
 */
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    36
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    37
import com.sun.tools.javac.util.Assert;
26100
bb7dd001d190 8050429: Update/cleanup ToolBox
jjg
parents: 19489
diff changeset
    38
import java.nio.file.Paths;
19489
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    39
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    40
public class CheckRejectProfileBCPOptionsIfUsedTogetherTest {
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    41
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    42
    private static final String TestSrc =
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    43
        "public class Test {\n" +
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    44
        "    javax.swing.JButton b;\n" +
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    45
        "}";
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    46
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    47
    public static void main(String args[]) throws Exception {
26100
bb7dd001d190 8050429: Update/cleanup ToolBox
jjg
parents: 19489
diff changeset
    48
        ToolBox tb = new ToolBox();
26264
a09fedde76be 8044859: javac duplicates option processing when using Compiler API
jjg
parents: 26100
diff changeset
    49
        tb.writeFile("Test.java", TestSrc);
19489
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    50
26100
bb7dd001d190 8050429: Update/cleanup ToolBox
jjg
parents: 19489
diff changeset
    51
        ToolBox.Result result = tb.new JavacTask(ToolBox.Mode.CMDLINE)
bb7dd001d190 8050429: Update/cleanup ToolBox
jjg
parents: 19489
diff changeset
    52
                .options("-profile", "compact1",
bb7dd001d190 8050429: Update/cleanup ToolBox
jjg
parents: 19489
diff changeset
    53
                        "-bootclasspath", Paths.get(ToolBox.testJDK, "jre/lib/rt.jar").toString())
26264
a09fedde76be 8044859: javac duplicates option processing when using Compiler API
jjg
parents: 26100
diff changeset
    54
                .files("Test.java")
a09fedde76be 8044859: javac duplicates option processing when using Compiler API
jjg
parents: 26100
diff changeset
    55
                .run(ToolBox.Expect.FAIL)
a09fedde76be 8044859: javac duplicates option processing when using Compiler API
jjg
parents: 26100
diff changeset
    56
                .writeAll();
19489
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    57
26100
bb7dd001d190 8050429: Update/cleanup ToolBox
jjg
parents: 19489
diff changeset
    58
        String out = result.getOutput(ToolBox.OutputKind.DIRECT);
bb7dd001d190 8050429: Update/cleanup ToolBox
jjg
parents: 19489
diff changeset
    59
        Assert.check(out.startsWith(
19489
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    60
                "javac: profile and bootclasspath options cannot be used together"),
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    61
                "Incorrect javac error output");
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    62
    }
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    63
387a4dd51adf 8009640: -profile <compact> does not work when -bootclasspath specified
vromero
parents:
diff changeset
    64
}