-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b120
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2203363 | 6u24 | Unassigned | P3 | Closed | Won't Fix |
The following code should be rejected by javac:
class Param<T> {}
interface A { void f(Param<String> ls); }
interface B extends A { void f(Param<Integer> li); }
JLS 9.4.1 Inheritance and Overriding:
--
It is a compile time error if a type declaration T has a member method m1 and there exists a method m2 declared in T or a supertype of T such that all of the following conditions hold:
* m1 and m2 have the same name.
* m2 is accessible from T.
* The signature of m1 is not a subsignature (§8.4.2) of the signature of m2.
* m1 or some method m1 overrides (directly or indirectly) has the same erasure as m2 or some method m2 overrides (directly or indirectly).
--
Thus, interface B should generate a compile-time error:
- B.f and A.f have the same name
- A.f is accessible from B
- The signature of B.f is not a subsignature of A.f
- B.f has the same erasure as A.f
class Param<T> {}
interface A { void f(Param<String> ls); }
interface B extends A { void f(Param<Integer> li); }
JLS 9.4.1 Inheritance and Overriding:
--
It is a compile time error if a type declaration T has a member method m1 and there exists a method m2 declared in T or a supertype of T such that all of the following conditions hold:
* m1 and m2 have the same name.
* m2 is accessible from T.
* The signature of m1 is not a subsignature (§8.4.2) of the signature of m2.
* m1 or some method m1 overrides (directly or indirectly) has the same erasure as m2 or some method m2 overrides (directly or indirectly).
--
Thus, interface B should generate a compile-time error:
- B.f and A.f have the same name
- A.f is accessible from B
- The signature of B.f is not a subsignature of A.f
- B.f has the same erasure as A.f
- backported by
-
JDK-2203363 Alike methods in interfaces (Inheritance and Overriding)
- Closed
- relates to
-
JDK-7020657 Javac rejects a fairly common idiom with raw override and interfaces
- Closed
-
JDK-6435238 Use of an unchecked conversion generates redundant compiler warnings.
- Closed