<div dir="ltr">Hi Alex,<div><br></div><div>Liam is trying to get javac8 up and running with our source base. He seems to be encountering this particular issue a fair bit, which makes me think that this should be listed in the Official Big List of Java 8 Incompatibilities. Who is the right contact for that? Joe Darcy?</div>
<div><br></div><div>Jeremy</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 16, 2013 at 5:52 PM, cushon <span dir="ltr"><<a href="mailto:cushon@google.com" target="_blank">cushon@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for the explanation. I posted on lambda-dev here: <a href="http://mail.openjdk.java.net/pipermail/lambda-dev/2013-October/011299.html" target="_blank">http://mail.openjdk.java.net/pipermail/lambda-dev/2013-October/011299.html</a></div>
<div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 16, 2013 at 4:52 PM, Alex Buckley <span dir="ltr"><<a href="mailto:alex.buckley@oracle.com" target="_blank">alex.buckley@oracle.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The common theme is that you're passing values of raw types, so an unchecked conversion is necessary for a method to be applicable, so the return type of the chosen method is erased, so Object appears in places where a more specific type is necessary. The relevant JLS rules have not changed substantively in SE 8, so to a first approximation javac is behaving correctly. I would encourage you to post on lambda-dev as generics in javac are dominated by Lambda at this time.<span><font color="#888888"><br>
<br>
Alex</font></span><div><div><br>
<br>
On 10/16/2013 4:08 PM, Liam Miller-Cushon wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
The following programs do not compile with the jdk8 javac. (I tried b111 and<br>
954dd199d6ff). All of the programs compile with the jdk7 javac.<br>
<br>
------------------------------<u></u>------------------------------<u></u>-------------------<br>
import java.util.List;<br>
<br>
class ReproOne {<br>
<br>
static class Baz<T> {<br>
public static List<Baz<Object>> getElements(Baz<Object> transcoder) {<br>
return null;<br>
}<br>
}<br>
<br>
private static void bar(Baz arg) {<br>
for (Baz element : Baz.getElements(arg)) {}<br>
}<br>
}<br>
------------------------------<u></u>------------------------------<u></u>-------------------<br>
abstract class ReproTwo<T> {<br>
<br>
class Bar<E> {}<br>
<br>
T get(Bar<? extends T> arg1, Bar arg2) {<br>
return circularGet(arg2, arg2);<br>
}<br>
<br>
abstract T circularGet(final Bar<? extends T> arg1, final Bar<?> arg2);<br>
}<br>
------------------------------<u></u>------------------------------<u></u>-------------------<br>
abstract class ReproThree<T, V> {<br>
<br>
class Binding<E> {}<br>
class ProviderBinding<E> extends Binding<E> {}<br>
<br>
abstract V visitOther(Binding<? extends T> binding);<br>
<br>
public V visitTwo(ProviderBinding<? extends T> providerBinding) {<br>
return visitOther((Binding) providerBinding);<br>
}<br>
}<br>
------------------------------<u></u>------------------------------<u></u>-------------------<br>
<br>
javac output:<br>
<br>
ReproOne.java:12: error: incompatible types: Object cannot be converted<br>
to Baz<br>
for (Baz element : Baz.getElements(arg)) {}<br>
^<br>
<br>
ReproTwo.java:6: error: incompatible types: Object cannot be converted to T<br>
return circularGet(arg2, arg2);<br>
^<br>
where T is a type-variable:<br>
T extends Object declared in class ReproTwo<br>
<br>
ReproThree.java:10: error: incompatible types: Object cannot be<br>
converted to V<br>
return visitOther((Binding) providerBinding);<br>
^<br>
where V is a type-variable:<br>
V extends Object declared in class ReproThree<br>
</blockquote>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>