author | yzheng |
Wed, 16 Oct 2019 16:54:56 +0200 | |
changeset 58650 | d068b1e534de |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
5520
diff
changeset
|
2 |
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5520 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
10 | 22 |
*/ |
23 |
||
24 |
/* |
|
25 |
* @test |
|
26 |
* @bug 6405099 |
|
27 |
* @summary Compiler crashes when javac encounters /usr/jdk/packges/lib/ext with no 777 permissions |
|
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
5520
diff
changeset
|
28 |
* @modules jdk.compiler |
10 | 29 |
*/ |
30 |
||
2986 | 31 |
import java.io.*; |
10 | 32 |
|
33 |
public class T6405099 |
|
34 |
{ |
|
35 |
public static void main(String[] args) { |
|
36 |
File bad = new File("bad"); |
|
2986 | 37 |
try { |
38 |
bad.mkdir(); |
|
39 |
bad.setReadable(false); |
|
40 |
bad.setExecutable(false); |
|
41 |
||
42 |
test(bad); |
|
43 |
||
44 |
} finally { |
|
45 |
bad.setExecutable(true); |
|
46 |
bad.setReadable(true); |
|
47 |
} |
|
48 |
} |
|
49 |
||
50 |
static void test(File dir) { |
|
51 |
String[] args = { |
|
36526 | 52 |
"-source", "8", "-target", "8", // -extdirs not allowed after -target 8 |
53 |
"-extdirs", dir.getPath(), |
|
54 |
"-d", ".", |
|
2986 | 55 |
new File(System.getProperty("test.src", "."), "T6405099.java").getPath() |
56 |
}; |
|
57 |
||
58 |
StringWriter sw = new StringWriter(); |
|
59 |
PrintWriter pw = new PrintWriter(sw); |
|
60 |
int rc = com.sun.tools.javac.Main.compile(args, pw); |
|
36526 | 61 |
pw.close(); |
62 |
System.out.println(sw); |
|
63 |
||
2986 | 64 |
if (rc != 0) |
65 |
throw new Error("compilation failed"); |
|
10 | 66 |
} |
67 |
} |