author | darcy |
Fri, 02 Feb 2018 10:29:25 -0800 | |
changeset 48723 | 6cb86bf0b51e |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
37942
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
1 |
/* |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
4 |
* |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
8 |
* |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
13 |
* accompanied this code). |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
14 |
* |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
18 |
* |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
21 |
* questions. |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
22 |
*/ |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
23 |
|
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
24 |
/* |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
25 |
* @test |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
26 |
* @bug 8156097 |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
27 |
* @summary Check that nested TypeEnter.MembersPhase invocations don't cause StackOverflowError |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
28 |
* @library /tools/lib |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
29 |
* @modules jdk.compiler/com.sun.tools.javac.api |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
30 |
* jdk.compiler/com.sun.tools.javac.main |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
31 |
*/ |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
32 |
import java.io.IOException; |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
33 |
import java.nio.file.Files; |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
34 |
import java.nio.file.Path; |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
35 |
import java.nio.file.Paths; |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
36 |
|
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
37 |
import toolbox.JavacTask; |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
38 |
import toolbox.ToolBox; |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
39 |
|
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
40 |
public class TestDeepFinishClassStack { |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
41 |
public static void main(String... args) throws IOException { |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
42 |
new TestDeepFinishClassStack().run(); |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
43 |
} |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
44 |
|
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
45 |
int depth = 1000; |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
46 |
|
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
47 |
void run() throws IOException { |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
48 |
Path src = Paths.get("src"); |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
49 |
|
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
50 |
Files.createDirectories(src); |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
51 |
|
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
52 |
ToolBox tb = new ToolBox(); |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
53 |
|
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
54 |
for (int i = 0; i < depth; i++) { |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
55 |
tb.writeJavaFiles(src, "public class C" + i + " { public void test(C" + (i + 1) + " c) { } }"); |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
56 |
} |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
57 |
|
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
58 |
tb.writeJavaFiles(src, "public class C" + depth + " { }"); |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
59 |
|
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
60 |
new JavacTask(tb).files(src.resolve("C0.java")) |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
61 |
.sourcepath(src) |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
62 |
.outdir(".") |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
63 |
.run() |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
64 |
.writeAll(); |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
65 |
} |
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
66 |
|
b0e834553947
8156097: docs build fails with StackOverflowError on Solaris
jlahoda
parents:
diff
changeset
|
67 |
} |