<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Archie Cobbs" <archie.cobbs@gmail.com><br><b>To: </b>"compiler-dev" <compiler-dev@openjdk.java.net><br><b>Sent: </b>Thursday, February 9, 2023 8:04:09 PM<br><b>Subject: </b>NameClashSameErasureNoOverride1.java<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr">We have this unit test <span style="font-family:monospace">diags/examples/NameClashSameErasureNoOverride1.java:</span><div style="margin-left:40px"><span style="font-family:monospace"><br></span></div><div style="margin-left:40px"><span style="font-family:monospace">// key: compiler.err.name.clash.same.erasure.no.override.1<br><br>public class NameClashSameErasureNoOverride1 {<br><br>    interface I<X> {<br>        void m(X l);<br>    }<br><br>    class A {<br>        void m(Object l) {}<br>    }<br><br>    class B extends A implements I<Integer> {<br>        public void m(Integer l) {}<br>    }<br>}</span><br></div><br><div>This program is NOT supposed to compile, but rather fail with "name clash: ... two methods with the same erasure, yet neither overrides the other".</div><br><div>It seems like the erasure of <span style="font-family:monospace">A.m()</span> is <span style="font-family:monospace">m(Object)</span> and the erasure of <span style="font-family:monospace">B.m()</span> is <span style="font-family:monospace">m(Integer)</span> - and these are not the same, so there's no clash.<br></div><br><div>What am I missing?</div></div></blockquote><div><br></div><div>bridges :)<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>class B is erased to<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><span style="font-family: monospace;" data-mce-style="font-family: monospace;">class B extends A implements I {</span></div><div><span style="font-family: monospace;" data-mce-style="font-family: monospace;">  public /*bridge*/ void m(Object o) {<br>    m((Integer) o);<br>  }<br>  public void m(Integer l) {}<br>}</span></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><div><br></div><br><div>Thanks,</div><div>-Archie</div></div></blockquote><div><br></div><div>RĂ©mi<br data-mce-bogus="1"></div><div><br></div></div></div></body></html>