Recursive lambda on field declarations in local classes and anonymous classes.
bitter_fox
bitterfoxc at gmail.com
Wed Feb 22 07:24:32 PST 2012
I've just got the fix.
Thank you for the fix.
Regards,
bitter_fox
2012/2/22 maurizio cimadamore <maurizio.cimadamore at oracle.com>
> I will look into this - thanks for the report.
>
> Maurizio
>
>
> On 21-Feb-12 10:44 PM, bitter_fox wrote:
>
>> Hi,
>> To use recursive lambda expressions, we have to use that statement:
>> SAM sam = () -> sam.invoke();
>>
>> However, the newest compiler rejects it on field declarations in local
>> classes and anonymous classes.
>> Cannot we use recursive lambda expressions in these situations?
>>
>> public class Main
>> {
>> interface SAM
>> {
>> void invoke();
>> }
>>
>> SAM sam = () -> sam.invoke(); // Legal
>>
>> class Inner
>> {
>> SAM sam = () -> sam.invoke(); // Legal
>> }
>>
>> Object obj = new Object()
>> {
>> SAM sam = () -> sam.invoke(); // Illegal
>> };
>>
>> public static void main(String[] args)
>> {
>> class Local
>> {
>> SAM sam = () -> sam.invoke(); // Illegal
>> }
>>
>> new Object()
>> {
>> SAM sam = () -> sam.invoke(); // Illegal
>> };
>> }
>>
>> public void method()
>> {
>> class Local
>> {
>> SAM sam = () -> sam.invoke(); // Illegal
>> }
>>
>> new Object()
>> {
>> SAM sam = () -> sam.invoke(); // Illegal
>> };
>> }
>> }
>>
>> Regards,
>> bitter_fox
>>
>>
>
More information about the lambda-dev
mailing list