author | vlivanov |
Tue, 26 Nov 2019 16:09:21 +0300 | |
changeset 59276 | 94a84abb873b |
parent 52377 | 907fdbbdf584 |
permissions | -rw-r--r-- |
34991
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
1 |
/* |
35356
e919fd8db52c
8056989: Sjavac --server option should be optional
alundblad
parents:
34991
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
34991
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
4 |
* |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
52377 | 7 |
* published by the Free Software Foundation. |
34991
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
8 |
* |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
13 |
* accompanied this code). |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
14 |
* |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
18 |
* |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
21 |
* questions. |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
22 |
*/ |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
23 |
|
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
24 |
/* |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
25 |
* @test |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
26 |
* @bug 8144226 |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
27 |
* @summary Ensures that excluded files are inaccessible (even for implicit |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
28 |
* compilation) |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37643
diff
changeset
|
29 |
* @modules jdk.compiler/com.sun.tools.javac.main |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37643
diff
changeset
|
30 |
* jdk.compiler/com.sun.tools.sjavac |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37643
diff
changeset
|
31 |
* jdk.compiler/com.sun.tools.sjavac.server |
34991
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
32 |
* @library /tools/lib |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37643
diff
changeset
|
33 |
* @build Wrapper toolbox.ToolBox toolbox.Assert |
34991
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
34 |
* @run main Wrapper HiddenFiles |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
35 |
*/ |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
36 |
|
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
37 |
|
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
38 |
import java.nio.file.Files; |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
39 |
import java.nio.file.Path; |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
40 |
import java.nio.file.Paths; |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
41 |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37643
diff
changeset
|
42 |
import com.sun.tools.javac.main.Main.Result; |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37643
diff
changeset
|
43 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37643
diff
changeset
|
44 |
import toolbox.Assert; |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37643
diff
changeset
|
45 |
|
34991
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
46 |
public class HiddenFiles extends SjavacBase { |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
47 |
|
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
48 |
public static void main(String[] ignore) throws Exception { |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
49 |
Path BIN = Paths.get("bin"); |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
50 |
Path STATE_DIR = Paths.get("state-dir"); |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
51 |
Path SRC = Paths.get("src"); |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
52 |
|
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
53 |
Files.createDirectories(BIN); |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
54 |
Files.createDirectories(STATE_DIR); |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
55 |
|
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
56 |
toolbox.writeJavaFiles(SRC, "package pkg; class A { B b; }"); |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
57 |
toolbox.writeJavaFiles(SRC, "package pkg; class B { }"); |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
58 |
|
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
59 |
// This compilation should fail (return RC_FATAL) since A.java refers to B.java and B.java |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
60 |
// is excluded. |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
61 |
int rc = compile("-x", "pkg/B.java", SRC.toString(), |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
62 |
"-d", BIN.toString(), |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
63 |
"--state-dir=" + STATE_DIR); |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
64 |
|
37643
626e07816dce
8048146: sjavac uses unexpected exit code of -1
alundblad
parents:
36778
diff
changeset
|
65 |
Assert.check(rc == Result.ERROR.exitCode, "Compilation succeeded unexpectedly."); |
34991
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
66 |
} |
ff8be37d1164
8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents:
diff
changeset
|
67 |
} |