Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 436834

Summary: [1.8][clean up] Convert lambda to anonymous class does not convert nested lambdas
Product: [Eclipse Project] JDT Reporter: Dani Megert <daniel_megert>
Component: UIAssignee: Noopur Gupta <noopur_gupta>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r, noopur_gupta
Version: 4.4   
Target Milestone: 4.5 M2   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=434884
Whiteboard:

Description Dani Megert CLA 2014-06-06 08:14:19 EDT
4.4 RC4.

Convert to lambda does not convert nested lambdas.

Test Case:
	void test() {
		Callable<Runnable> callable= () -> () -> System.out.println();
	}
Comment 1 Noopur Gupta CLA 2014-06-11 03:39:17 EDT
The ASTRewrite in LambdaExpressionsFix.CreateAnonymousClassCreationOperation#rewriteAST contains both the events to convert both the lambdas to anonymous classes.
However, finally only the outer lambda is converted.

The problem looks similar to bug 434884 comment #2 in the reverse conversion.

Note that if the body of outer lambda is converted to a block, then the cleanup works fine.
Comment 2 Noopur Gupta CLA 2014-08-07 03:04:30 EDT
This will be fixed with the patch for bug 434884.

*** This bug has been marked as a duplicate of bug 434884 ***