type variables from enclosing types?
daniel.smith at oracle.com
Mon Dec 9 12:30:35 PST 2013
On Dec 7, 2013, at 5:10 PM, Stephan Herrmann <stephan.herrmann at berlin.de> wrote:
>>> 4) I made experiments with pulling E into the inference
>>> by augmenting 18.2.3 bullet 5.2: I added corresponding
>>> constraints also for the type variables of enclosing types
>>> of C<A1, ..., An> and C<B1, ..., Bn>. This directed the
>>> inference into the expected solution,
>> Yep, that's the right approach. The 5.2 bullet is meant to cover this case, too.
> I take your word for it, because I don't see this at all in the existing text.
Yes, this is the point of the new bug I mentioned, https://bugs.openjdk.java.net/browse/JDK-8029704.
> BTW: finding a solution for
> X<String>.Y<String> x2 = new X<>().new Y<>("","");
> seems to be out of scope for Java 8 type inference, right?
Yep. "new X<>()" is a standalone expression, so you'll get an X<Object>.
More information about the lambda-spec-observers