<div dir="ltr">Created <a href="https://bugs.openjdk.org/browse/JDK-8364144">https://bugs.openjdk.org/browse/JDK-8364144</a>.</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, Jul 19, 2025 at 7:28 PM Nir Lisker <<a href="mailto:nlisker@gmail.com">nlisker@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>Initially reported in the Eclipse compiler since ECJ accepts code that javac does not: <a href="https://github.com/eclipse-jdt/eclipse.jdt.core/issues/4226" target="_blank">https://github.com/eclipse-jdt/eclipse.jdt.core/issues/4226</a>. The current assessment is that the fault is with javac.</div><div><br></div><div>Copying the example from there:</div><div><br></div>```<br><font face="monospace">interface Culprit {}<br><br>class EntityInfo<E extends NumberGenerator<?> & Culprit> {}<br><br>class NumberGenerator<N extends Number> implements NumberSupplier<N> {<br><br> @Override<br> public N getNumber() {<br> return null;<br> }<br>}<br><br>interface NumberSupplier<N extends Number> {<br><br> N getNumber();<br>}</font><div>```</div><div><br></div><div>javac fails with:</div><div>```</div><div><font face="monospace">error: getNumber() in NumberGenerator cannot implement getNumber() in NumberSupplier<br>class EntityInfo<E extends NumberGenerator<?> & Culprit> {}<br> ^<br> return type CAP#1 is not compatible with CAP#2<br> where N#1,N#2 are type-variables:<br> N#1 extends Number declared in class NumberGenerator<br> N#2 extends Number declared in interface NumberSupplier<br> where CAP#1,CAP#2 are fresh type-variables:<br> CAP#1 extends Number from capture of ?<br> CAP#2 extends Number from capture of ?<br>1 error</font></div><div>```</div><div><br></div><div>Removing the Culprit bound:</div><div><span style="font-family:monospace">class EntityInfo<E extends NumberGenerator<?>> {}</span></div><div><span style="font-family:monospace"><br></span></div>satisfies javac.<div><br></div><div>Also noted that combining the supertypes explicitly is accepted:</div><div>```</div><div><font face="monospace">class X<T extends Number> extends NumberGenerator<T> implements Culprit {<br>}<br><br>class EI2<E extends X<?>> {}</font></div><div>```</div><div><br></div><div>Thanks,</div><div>Nir</div></div>
</blockquote></div>