langtools/test/tools/javac/7132880/T7132880.java
author sogoel
Thu, 05 Jun 2014 10:57:10 -0700
changeset 24797 850ebd4d80a7
parent 12076 1b7560bd1760
permissions -rw-r--r--
8044072: Group 2: create .out files for OverrideChecks tests in tools/javac dir Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12076
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
     1
/*
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
     3
 * @bug 7132880
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
     4
 * @summary Resolve should support nested resolution contexts
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
     5
 * @compile/fail/ref=T7132880.out -XDrawDiagnostics T7132880.java
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
     6
 */
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
     7
class Outer {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
     8
    void m1(String s) { }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
     9
    void m2(int i1, int i2) { }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    10
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    11
    class Inner {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    12
        void test() {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    13
           //ok - no method named 'm' in Inner - hence, class to search is Outer
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    14
           m1("");
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    15
        }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    16
    }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    17
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    18
    class Inner1 {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    19
        void m1(Integer i) { }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    20
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    21
        void test() {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    22
           //error - Inner1 defines an incompatible method - hence, class to search is Inner1
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    23
           m1("");
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    24
        }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    25
    }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    26
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    27
    class Inner2 {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    28
        private void m1(Integer i) { }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    29
        private void m1(Double d) { }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    30
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    31
        void test() {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    32
           //error - Inner2 defines multiple incompatible methods - hence, class to search is Inner2
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    33
           m1("");
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    34
        }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    35
    }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    36
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    37
    class Inner3 {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    38
        private void m2(Object o, int i) { }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    39
        private void m2(int i, Object o) { }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    40
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    41
        void test() {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    42
           //error - Inner3 defines multiple ambiguous methods - hence, class to search is Inner3
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    43
           m2(1, 1);
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    44
        }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    45
    }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    46
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    47
    class Inner4 extends Inner2 {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    48
        void test() {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    49
           //ok - Inner2 defines multiple incompatible inaccessible methods - hence, class to search is Outer
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    50
           m1("");
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    51
        }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    52
    }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    53
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    54
    class Inner5 extends Inner3 {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    55
        void test() {
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    56
           //ok - Inner3 defines multiple inaccessible ambiguous methods - hence, class to search is Outer
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    57
           m2(1, 1);
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    58
        }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    59
    }
1b7560bd1760 7132880: Resolve should support nested resolution contexts
mcimadamore
parents:
diff changeset
    60
}