author | mcimadamore |
Sun, 04 Nov 2012 10:59:42 +0000 | |
changeset 14443 | 91c05eb19277 |
child 14547 | 86d8d242b0c4 |
permissions | -rw-r--r-- |
14443
91c05eb19277
7192246: Add type-checking support for default methods
mcimadamore
parents:
diff
changeset
|
1 |
/* |
91c05eb19277
7192246: Add type-checking support for default methods
mcimadamore
parents:
diff
changeset
|
2 |
* @test /nodynamiccopyright/ |
91c05eb19277
7192246: Add type-checking support for default methods
mcimadamore
parents:
diff
changeset
|
3 |
* @summary check that default method must have most specific return type |
91c05eb19277
7192246: Add type-checking support for default methods
mcimadamore
parents:
diff
changeset
|
4 |
* @compile/fail/ref=Neg04.out -XDallowDefaultMethods -XDrawDiagnostics Neg04.java |
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 |
|
91c05eb19277
7192246: Add type-checking support for default methods
mcimadamore
parents:
diff
changeset
|
7 |
class Neg04 { |
91c05eb19277
7192246: Add type-checking support for default methods
mcimadamore
parents:
diff
changeset
|
8 |
interface IA1 { Integer m(); } |
91c05eb19277
7192246: Add type-checking support for default methods
mcimadamore
parents:
diff
changeset
|
9 |
interface IA2 extends IA1 { default Number m() { return Neg04.m(this); } } //error |
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 |
abstract class C implements IA1, IA2 {} |
91c05eb19277
7192246: Add type-checking support for default methods
mcimadamore
parents:
diff
changeset
|
12 |
|
91c05eb19277
7192246: Add type-checking support for default methods
mcimadamore
parents:
diff
changeset
|
13 |
static int m(IA2 a) { return 0; } |
91c05eb19277
7192246: Add type-checking support for default methods
mcimadamore
parents:
diff
changeset
|
14 |
} |