NestedDiamondAllocationTest.java revision 2956:8d7f82e6d1b5
1147191Sjkoshy/* 2174215Sjkoshy * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. 3174215Sjkoshy * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4147191Sjkoshy * 5147191Sjkoshy * This code is free software; you can redistribute it and/or modify it 6174215Sjkoshy * under the terms of the GNU General Public License version 2 only, as 7174215Sjkoshy * published by the Free Software Foundation. 8174215Sjkoshy * 9147191Sjkoshy * This code is distributed in the hope that it will be useful, but WITHOUT 10147191Sjkoshy * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11147191Sjkoshy * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12147191Sjkoshy * version 2 for more details (a copy is included in the LICENSE file that 13147191Sjkoshy * accompanied this code). 14147191Sjkoshy * 15147191Sjkoshy * You should have received a copy of the GNU General Public License version 16147191Sjkoshy * 2 along with this work; if not, write to the Free Software Foundation, 17147191Sjkoshy * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18147191Sjkoshy * 19147191Sjkoshy * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20147191Sjkoshy * or visit www.oracle.com if you need additional information or have any 21147191Sjkoshy * questions. 22147191Sjkoshy */ 23147191Sjkoshy 24147191Sjkoshy/* 25147191Sjkoshy * @test 26147191Sjkoshy * @bug 8081521 27147191Sjkoshy * @summary Ensure that anonymous class construction using <> can be nested within another 28147191Sjkoshy * @compile NestedDiamondAllocationTest.java 29147191Sjkoshy * @run main NestedDiamondAllocationTest 30147191Sjkoshy * 31147191Sjkoshy */ 32147191Sjkoshy 33147191Sjkoshypublic class NestedDiamondAllocationTest { 34147191Sjkoshy static class Clazz2 { 35147191Sjkoshy static class A { 36147191Sjkoshy }; 37147191Sjkoshy public A a; 38147191Sjkoshy } 39147191Sjkoshy static class FooNest<Q> { 40147191Sjkoshy FooNest(Q q, Foo<Q> foo) { 41147191Sjkoshy } 42147191Sjkoshy } 43147191Sjkoshy 44147191Sjkoshy static class Foo<T> { 45147191Sjkoshy } 46147191Sjkoshy 47147191Sjkoshy static Clazz2 clazz = new Clazz2(); 48147191Sjkoshy 49147191Sjkoshy public static void main(String [] args) { 50185363Sjkoshy FooNest fooNest = new FooNest<>(clazz.a, new Foo<>() { 51185363Sjkoshy }); 52147191Sjkoshy } 53147191Sjkoshy} 54147191Sjkoshy