langtools/test/tools/javac/defaultMethods/Neg12.java
author vasya
Mon, 14 Dec 2015 20:18:19 +0100
changeset 34752 9c262a013456
parent 19934 1d8232b1aa18
permissions -rw-r--r--
8145342: Some copyright notices are inconsistently and ill formatted Summary: Adjusted formatting of copyright notices. Reviewed-by: darcy, alundblad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19934
1d8232b1aa18 8005222: Fixed bugs should have tests with bugid in @bug tag
jfranck
parents: 14547
diff changeset
     1
/* @test /nodynamiccopyright/
1d8232b1aa18 8005222: Fixed bugs should have tests with bugid in @bug tag
jfranck
parents: 14547
diff changeset
     2
 * @bug 7192246
14443
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
     3
 * @summary check that abstract methods are discarded in overload resolution diags
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14443
diff changeset
     4
 * @compile/fail/ref=Neg12.out -XDrawDiagnostics Neg12.java
14443
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
     5
 */
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
     6
class Neg12 {
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
     7
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
     8
    interface I1 {
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
     9
        default void m(String s) {};
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    10
    }
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    11
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    12
    interface I2 {
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    13
        void m(String s);
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    14
    }
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    15
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    16
    static class B {
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    17
        void m(Integer i) { }
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    18
    }
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    19
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    20
    static class C extends B implements I1 { }
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    21
    static class D extends B implements I2 { }
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    22
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    23
    void test(C c, D d) {
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    24
        c.m();
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    25
        d.m();
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    26
    }
91c05eb19277 7192246: Add type-checking support for default methods
mcimadamore
parents:
diff changeset
    27
}