author | akulyakh |
Thu, 21 May 2015 11:41:04 -0700 | |
changeset 30730 | d3ce7619db2c |
parent 26264 | a09fedde76be |
child 40316 | 20b50a99fe8d |
permissions | -rw-r--r-- |
26264
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
1 |
/* |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26264
diff
changeset
|
2 |
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
26264
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
4 |
* |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
8 |
* |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
13 |
* accompanied this code). |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
14 |
* |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
18 |
* |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
21 |
* questions. |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
22 |
*/ |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
23 |
|
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
24 |
/* |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
25 |
* @test |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
26 |
* @bug 8044859 |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
27 |
* @summary test support for checking -profile and -bootclasspath |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26264
diff
changeset
|
28 |
* @modules jdk.compiler/com.sun.tools.javac.api |
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26264
diff
changeset
|
29 |
* jdk.compiler/com.sun.tools.javac.file |
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26264
diff
changeset
|
30 |
* jdk.compiler/com.sun.tools.javac.main |
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26264
diff
changeset
|
31 |
* jdk.compiler/com.sun.tools.javac.util |
26264
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
32 |
* @build Tester |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
33 |
* @run main ProfileBootClassPathTest |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
34 |
*/ |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
35 |
|
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
36 |
import com.sun.tools.javac.main.Main; |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
37 |
import java.io.File; |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
38 |
import java.io.IOException; |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
39 |
|
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
40 |
public class ProfileBootClassPathTest extends Tester { |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
41 |
public static void main(String... args) throws Exception { |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
42 |
ProfileBootClassPathTest t = new ProfileBootClassPathTest(); |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
43 |
t.runTests(); |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
44 |
} |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
45 |
|
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
46 |
@Tester.Test |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
47 |
void testProfileBootClassPath() throws IOException { |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
48 |
writeFile("C.java", "class C { }"); |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
49 |
|
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
50 |
String javaHome = System.getProperty("java.home"); |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
51 |
String rt_jar = new File(javaHome, "jre/lib/rt.jar").getPath(); |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
52 |
String[] opts = { "-profile", "compact1", "-bootclasspath", rt_jar }; |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
53 |
String[] files = { "C.java" }; |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
54 |
|
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
55 |
runMain(opts, files) |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
56 |
.checkResult(Main.Result.CMDERR.exitCode); |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
57 |
|
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
58 |
// The API tests are disabled (for now) because Args.validate does |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
59 |
// not have an easy way to access/validate file manager options, |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
60 |
// which are handled directly by the file manager |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
61 |
|
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
62 |
// runCall(opts, files) |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
63 |
// .checkIllegalStateException(); |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
64 |
|
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
65 |
// runParse(opts, files) |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
66 |
// .checkIllegalStateException(); |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
67 |
} |
a09fedde76be
8044859: javac duplicates option processing when using Compiler API
jjg
parents:
diff
changeset
|
68 |
} |