langtools/test/tools/javac/generics/diamond/6996914/T6996914b.java
author sadayapalam
Mon, 30 Mar 2015 17:09:14 +0530
changeset 29776 984a79b71cfe
parent 8635 383a416a2bdf
permissions -rw-r--r--
8062373: Project Coin: diamond and anonymous classes Summary: Allow diamond inference in combination with anonymous class instance creation Reviewed-by: mcimadamore, vromero Contributed-by: srikanth.adayapalam@oracle.com, maurizio.cimadamore@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7208
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
     1
/*
29776
984a79b71cfe 8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents: 8635
diff changeset
     2
 * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
7208
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
     4
 *
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
     8
 *
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    14
 *
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    18
 *
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    21
 * questions.
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    22
 */
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    23
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    24
/*
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    25
 * @test
29776
984a79b71cfe 8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents: 8635
diff changeset
    26
 * @bug 6996914 7020044 8062373
7208
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    27
 * @summary  Diamond inference: problem when accessing protected constructor
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    28
 * @compile T6996914b.java
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    29
 */
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    30
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    31
class Super<X,Y> {
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    32
    private Super(Integer i, Y y, X x) {}
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    33
    public Super(Number n, X x, Y y) {}
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    34
}
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    35
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    36
class Test {
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    37
    Super<String,Integer> ssi1 = new Super<>(1, "", 2);
29776
984a79b71cfe 8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents: 8635
diff changeset
    38
    Super<String,Integer> ssi2 = new Super<>(1, "", 2) {};
7208
5db8147393ec 6996914: Diamond inference: problem when accessing protected constructor
mcimadamore
parents:
diff changeset
    39
}