Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 527997 - Lambda as constructor parameter incorrectly considers to start anonymous subclass
Summary: Lambda as constructor parameter incorrectly considers to start anonymous subc...
Status: CLOSED DUPLICATE of bug 560919
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.8   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-01 03:35 EST by Andreas Sewe CLA
Modified: 2020-03-09 10:50 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sewe CLA 2017-12-01 03:35:30 EST
Noticed this while testing the Oxygen.2 RC3 EPP package:

Taken the following example (no compile errors), with the cursor indicated by the '$' sign:

import java.util.TreeMap;
public class Test {

	public static void main(String[] args) {
		new TreeMap<>($);
	}

}

I now type 

  (a, b) -> {

to start a lambda expression. Upon hitting the '{' the cursor and the curly brace move to an unexpected place:

import java.util.TreeMap;
public class Test {

	public static void main(String[] args) {
		new TreeMap<>((a, b) -> ) {$;
	}

}

Apparently, JDT thinks I want to implement an anonymous subclass of TreeMap at this point.
Comment 1 Noopur Gupta CLA 2017-12-07 06:01:29 EST

*** This bug has been marked as a duplicate of bug 520081 ***
Comment 2 Julian Honnen CLA 2020-03-09 10:50:59 EDT

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