Bug in javac and eclipse ??

Remi Forax forax at univ-mlv.fr
Wed Jan 22 10:16:17 PST 2014


On 01/22/2014 06:39 PM, Dan Smith wrote:
> On Jan 22, 2014, at 4:09 AM, Markus Keller <markus_keller at ch.ibm.com> wrote:
>
>> Remi, you are totally correct, this is a spec bug (oversight, since 8.3.3
>> was not updated when lambdas were added).
>> The Eclipse compiler had this right, until we bowed down to the bad spec:
>> https://bugs.eclipse.org/421926
>>
>> Unfortunately, my first mail on this subject was not perfect, since I
>> first also thought this was about "Self-reference to field from lambda
>> expression in initializer". Dan's answer also referred to a "recursive
>> lambda expression" feature, which shows that Oracle's internal discussion
>> was also based on wrong assumptions.
> Can you clarify what incorrect assumptions you think were made?  I'm not seeing any new information in this thread.
>
> I've tried to be very clear about where were at: sure, it would be convenient to do something here, but it's a complicated space and it deserves a lot more analysis before we commit to something.

While I agree that this is a complicated space, it was also already 
explored by the guys that design the previous versions of Java. And as 
far as I know, nobody ever complain, famous stupid words, maybe ...

As far as remember, the EG just decide to not support self reference in 
case of local variable
(mostly because in Java you cannot reference the address of a local 
variable from a scope that is not in the same method)

In case of a field, the lambda doesn't reference itself but 'this'. 
That's why if instead of using a lambda, one uses an anonymous class, it 
compiles.

Given that rules on self-reference already exist, I think it's better to 
not invent a new one.
The only issue IMO is that it seems that the JLS 7 doesn't clearly 
explicit these previous rules.

>    It's at the top of our "potential future enhancements" list.

there are so many items on that issue list that removing one is not an 
issue :)

>
> —Dan

Rémi



More information about the lambda-spec-experts mailing list