test/langtools/tools/javac/generics/diamond/pos/NestedDiamondAllocationTest.java
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 47216 71c04702a3d5
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31113
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
     1
/*
34752
9c262a013456 8145342: Some copyright notices are inconsistently and ill formatted
vasya
parents: 31113
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
31113
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
     4
 *
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
     7
 * published by the Free Software Foundation.
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
     8
 *
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    13
 * accompanied this code).
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    14
 *
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    18
 *
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    21
 * questions.
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    22
 */
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    23
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    24
/*
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    25
 * @test
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    26
 * @bug 8081521
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    27
 * @summary Ensure that anonymous class construction using <> can be nested within another
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    28
 * @compile NestedDiamondAllocationTest.java
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    29
 * @run main NestedDiamondAllocationTest
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    30
 *
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    31
 */
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    32
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    33
public class NestedDiamondAllocationTest {
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    34
    static class Clazz2 {
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    35
        static class A {
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    36
        };
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    37
        public A a;
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    38
    }
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    39
    static class FooNest<Q> {
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    40
        FooNest(Q q, Foo<Q> foo) {
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    41
        }
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    42
    }
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    43
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    44
    static class Foo<T> {
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    45
    }
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    46
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    47
    static Clazz2 clazz = new Clazz2();
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    48
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    49
    public static void main(String [] args) {
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    50
        FooNest fooNest = new FooNest<>(clazz.a, new Foo<>() {
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    51
        });
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    52
    }
646511cb5873 8081521: Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
sadayapalam
parents:
diff changeset
    53
}