langtools/test/tools/javac/resolve/tests/ReferenceOverload.java
changeset 10816 ce8a7e9d8882
equal deleted inserted replaced
10815:a719aa5f1631 10816:ce8a7e9d8882
       
     1 /*
       
     2  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     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 @TraceResolve
       
    25 class ReferenceOverload {
       
    26 
       
    27     static class A {}
       
    28     static class B extends A {}
       
    29     static class C extends B {}
       
    30     static class D extends C {}
       
    31     static class E extends D {}
       
    32 
       
    33     @Candidate(applicable=Phase.BASIC, mostSpecific=true)
       
    34     static void m_A(A a) {}
       
    35     @Candidate
       
    36     static void m_A(B a) {}
       
    37     @Candidate
       
    38     static void m_A(C a) {}
       
    39     @Candidate
       
    40     static void m_A(D a) {}
       
    41     @Candidate
       
    42     static void m_A(E a) {}
       
    43 
       
    44     @Candidate(applicable=Phase.BASIC, mostSpecific=false)
       
    45     static void m_B(A b) {}
       
    46     @Candidate(applicable=Phase.BASIC, mostSpecific=true)
       
    47     static void m_B(B b) {}
       
    48     @Candidate
       
    49     static void m_B(C b) {}
       
    50     @Candidate
       
    51     static void m_B(D b) {}
       
    52     @Candidate
       
    53     static void m_B(E b) {}
       
    54 
       
    55     @Candidate(applicable=Phase.BASIC, mostSpecific=false)
       
    56     static void m_C(A c) {}
       
    57     @Candidate(applicable=Phase.BASIC, mostSpecific=false)
       
    58     static void m_C(B c) {}
       
    59     @Candidate(applicable=Phase.BASIC, mostSpecific=true)
       
    60     static void m_C(C c) {}
       
    61     @Candidate
       
    62     static void m_C(D c) {}
       
    63     @Candidate
       
    64     static void m_C(E c) {}
       
    65 
       
    66     @Candidate(applicable=Phase.BASIC, mostSpecific=false)
       
    67     static void m_D(A d) {}
       
    68     @Candidate(applicable=Phase.BASIC, mostSpecific=false)
       
    69     static void m_D(B d) {}
       
    70     @Candidate(applicable=Phase.BASIC, mostSpecific=false)
       
    71     static void m_D(C d) {}
       
    72     @Candidate(applicable=Phase.BASIC, mostSpecific=true)
       
    73     static void m_D(D d) {}
       
    74     @Candidate
       
    75     static void m_D(E d) {}
       
    76 
       
    77     @Candidate(applicable=Phase.BASIC, mostSpecific=false)
       
    78     static void m_E(A e) {}
       
    79     @Candidate(applicable=Phase.BASIC, mostSpecific=false)
       
    80     static void m_E(B e) {}
       
    81     @Candidate(applicable=Phase.BASIC, mostSpecific=false)
       
    82     static void m_E(C e) {}
       
    83     @Candidate(applicable=Phase.BASIC, mostSpecific=false)
       
    84     static void m_E(D e) {}
       
    85     @Candidate(applicable=Phase.BASIC, mostSpecific=true)
       
    86     static void m_E(E e) {}
       
    87 
       
    88     {
       
    89         m_A((A)null);
       
    90         m_B((B)null);
       
    91         m_C((C)null);
       
    92         m_D((D)null);
       
    93         m_E((E)null);
       
    94     }
       
    95 }