author | alanb |
Thu, 17 Mar 2016 19:04:28 +0000 | |
changeset 36526 | 3b41f1c69604 |
parent 32337 | c9d3ab9f601c |
child 36778 | e04318f39f92 |
permissions | -rw-r--r-- |
19495
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
1 |
/* |
36526 | 2 |
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. |
19495
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
4 |
* |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
32337 | 7 |
* published by the Free Software Foundation. |
19495
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
8 |
* |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
13 |
* accompanied this code). |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
14 |
* |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
18 |
* |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
21 |
* questions. |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
22 |
*/ |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
23 |
|
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
24 |
/* |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
25 |
* @test |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
26 |
* @bug 8013394 |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
27 |
* @summary compile of iterator use fails with error "defined in an inaccessible class or interface" |
26100 | 28 |
* @library /tools/lib |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26100
diff
changeset
|
29 |
* @modules jdk.compiler/com.sun.tools.javac.api |
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26100
diff
changeset
|
30 |
* jdk.compiler/com.sun.tools.javac.file |
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26100
diff
changeset
|
31 |
* jdk.compiler/com.sun.tools.javac.main |
36526 | 32 |
* jdk.jdeps/com.sun.tools.javap |
19495
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
33 |
* @build ToolBox |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
34 |
* @run main CompileErrorWithIteratorTest |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
35 |
*/ |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
36 |
|
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
37 |
public class CompileErrorWithIteratorTest { |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
38 |
|
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
39 |
private static final String TestCollectionSrc = |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
40 |
"package pkg;\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
41 |
|
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
42 |
"import java.util.Iterator;\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
43 |
"import java.util.NoSuchElementException;\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
44 |
|
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
45 |
"public class TestCollection<E> implements Iterable<E> {\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
46 |
" public testCollectionIterator iterator() {\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
47 |
" return new testCollectionIterator();\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
48 |
" }\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
49 |
" class testCollectionIterator implements Iterator<E> {\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
50 |
" public boolean hasNext() { return true; }\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
51 |
" public E next() throws NoSuchElementException\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
52 |
" {\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
53 |
" return null;\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
54 |
" }\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
55 |
" public void remove() {}\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
56 |
" }\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
57 |
"}"; |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
58 |
|
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
59 |
private static final String TestSrc = |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
60 |
"import pkg.TestCollection;\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
61 |
"\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
62 |
"public class Test {\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
63 |
"\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
64 |
" public static void main(String[] args) {\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
65 |
" TestCollection<String> tc1 = new TestCollection<String>();\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
66 |
" for (String s : tc1) {\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
67 |
" System.out.println(s);\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
68 |
" }\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
69 |
" }\n" + |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
70 |
"}"; |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
71 |
|
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
72 |
public static void main(String args[]) throws Exception { |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
73 |
new CompileErrorWithIteratorTest().run(); |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
74 |
} |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
75 |
|
26100 | 76 |
ToolBox tb = new ToolBox(); |
77 |
||
19495
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
78 |
void run() throws Exception { |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
79 |
compile(); |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
80 |
} |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
81 |
|
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
82 |
void compile() throws Exception { |
26100 | 83 |
tb.new JavacTask() |
84 |
.sources(TestCollectionSrc, TestSrc) |
|
85 |
.run(); |
|
19495
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
86 |
} |
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
87 |
|
0a4337ec0592
8013394: compile of iterator use fails with error \"defined in an inaccessible class or interface\"
vromero
parents:
diff
changeset
|
88 |
} |