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 *
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.
22 */
23
24 /*
25 * @test
26 * @bug 8046171
27 * @summary Test access to private constructors between nestmates and nest-top
28 * using different flavours of named nested types that will
29 * generate invokespecial for the calls
30 * @compile -XDdisablePrivateAccessors TestInvokeSpecial.java
31 * @run main TestInvokeSpecial
32 */
33
34 public class TestInvokeSpecial {
35
36 // All constructors are private to ensure nestmate access checks apply
37
38 // All doConstruct methods are public so they don't involve invoke_special
39
40 private TestInvokeSpecial() {}
41
42 // The various nestmates
43
44 static interface StaticIface {
45
46 // Methods that will access private constructors of nestmates.
47 // The arg is a dummy for overloading purposes
48
49 default void doConstruct(TestInvokeSpecial o) {
50 Object obj = new TestInvokeSpecial();
51 }
|
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 *
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.
22 */
23
24 /*
25 * @test
26 * @bug 8046171
27 * @summary Test access to private constructors between nestmates and nest-top
28 * using different flavours of named nested types that will
29 * generate invokespecial for the calls. The -Xcomp run is a special
30 * regression test for a compiler assertion that would fire when
31 * "loading" a nest-top class.
32 * @compile -XDdisablePrivateAccessors TestInvokeSpecial.java
33 * @run main TestInvokeSpecial
34 * @run main/othervm -Xcomp TestInvokeSpecial
35 */
36
37 public class TestInvokeSpecial {
38
39 // All constructors are private to ensure nestmate access checks apply
40
41 // All doConstruct methods are public so they don't involve invoke_special
42
43 private TestInvokeSpecial() {}
44
45 // The various nestmates
46
47 static interface StaticIface {
48
49 // Methods that will access private constructors of nestmates.
50 // The arg is a dummy for overloading purposes
51
52 default void doConstruct(TestInvokeSpecial o) {
53 Object obj = new TestInvokeSpecial();
54 }
|