Archie Cobbs archie.cobbs at
Thu Feb 9 19:04:09 UTC 2023

We have this unit test diags/examples/

// key:

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?


Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the compiler-dev mailing list