NameClashSameErasureNoOverride1.java
Remi Forax
forax at univ-mlv.fr
Thu Feb 9 19:09:00 UTC 2023
> From: "Archie Cobbs" <archie.cobbs at gmail.com>
> To: "compiler-dev" <compiler-dev at openjdk.java.net>
> Sent: Thursday, February 9, 2023 8:04:09 PM
> Subject: NameClashSameErasureNoOverride1.java
> We have this unit test diags/examples/NameClashSameErasureNoOverride1.java:
> // key: compiler.err.name.clash.same.erasure.no.override.1
> public class NameClashSameErasureNoOverride1 {
> interface I<X> {
> void m(X l);
> }
> class A {
> void m(Object l) {}
> }
> class B extends A implements I<Integer> {
> public void m(Integer l) {}
> }
> }
> This program is NOT supposed to compile, but rather fail with "name clash: ...
> two methods with the same erasure, yet neither overrides the other".
> It seems like the erasure of A.m() is m(Object) and the erasure of B.m() is
> m(Integer) - and these are not the same, so there's no clash.
> What am I missing?
bridges :)
class B is erased to
class B extends A implements I {
public /*bridge*/ void m(Object o) {
m((Integer) o);
}
public void m(Integer l) {}
}
> Thanks,
> -Archie
Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20230209/b4b9003c/attachment.htm>
More information about the compiler-dev
mailing list