langtools/test/tools/javac/resolve/tests/AbstractMerge.java
author mcimadamore
Mon, 01 Jul 2013 14:57:03 +0100
changeset 18668 1f99c1b43ab2
child 34752 9c262a013456
permissions -rw-r--r--
7034798: Ambiguity error for abstract method call is too eager Summary: Javac should wait and see if ambiguous methods can be reconciled at the end of an overload resolution round Reviewed-by: jjg, vromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18668
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
     1
/*
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
     4
 *
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
     8
 *
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    14
 *
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    18
 *
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    21
 * questions.
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    22
 */
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    23
@TraceResolve
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    24
class AbstractMerge {
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    25
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    26
    interface A {
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    27
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    28
        java.io.Serializable m1();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    29
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    30
        java.io.Serializable m2();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    31
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    32
        java.io.Serializable m3();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    33
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    34
        java.io.Serializable m4();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    35
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    36
        java.io.Serializable m5();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    37
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    38
        java.io.Serializable m6();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    39
    }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    40
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    41
    interface B {
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    42
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    43
        Cloneable m1();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    44
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    45
        Cloneable m2();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    46
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    47
        Cloneable m3();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    48
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    49
        Cloneable m4();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    50
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    51
        Cloneable m5();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    52
        @Candidate(applicable=Phase.BASIC)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    53
        Cloneable m6();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    54
    }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    55
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    56
    interface C {
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    57
        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    58
        Object[] m1();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    59
        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    60
        Object[] m2();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    61
        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    62
        Object[] m3();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    63
        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    64
        Object[] m4();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    65
        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    66
        Object[] m5();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    67
        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    68
        Object[] m6();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    69
    }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    70
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    71
    interface ABC extends A, B, C { }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    72
    interface ACB extends A, C, B { }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    73
    interface BAC extends B, A, C { }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    74
    interface BCA extends B, C, A { }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    75
    interface CAB extends C, A, B { }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    76
    interface CBA extends C, B, A { }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    77
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    78
    {
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    79
        ABC abc = null;
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    80
        abc.m1();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    81
    }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    82
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    83
    {
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    84
        ACB acb = null;
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    85
        acb.m2();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    86
    }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    87
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    88
    {
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    89
        BAC bac = null;
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    90
        bac.m3();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    91
    }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    92
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    93
    {
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    94
        BCA bca = null;
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    95
        bca.m4();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    96
    }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    97
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    98
    {
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
    99
        CAB cab = null;
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
   100
        cab.m5();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
   101
    }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
   102
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
   103
    {
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
   104
        CBA cba = null;
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
   105
        cba.m6();
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
   106
    }
1f99c1b43ab2 7034798: Ambiguity error for abstract method call is too eager
mcimadamore
parents:
diff changeset
   107
}