Bug 516830 - Convert to anonymous inner class to lambda removes comments
Summary: Convert to anonymous inner class to lambda removes comments
Status: CLOSED DUPLICATE of bug 424266
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-17 12:57 EDT by Lars Vogel CLA
Modified: 2017-05-18 04:31 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 Lars Vogel CLA 2017-05-17 12:57:10 EDT
If I convert certain anonymous inner classes to lambda via the quick fix, comments are not preserved.

Example with an SWT button

button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				Job.create("Update table", new ICoreRunnable() {
					@Override
					public void run(IProgressMonitor monitor) throws CoreException {
						// do something long running
						// ...

						// If you want to update the UI
						System.out.println("Hello");
					}
				}).schedule();

			}
		});

Results in:

loadTableDataButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				Job.create("Update table", (ICoreRunnable) monitor -> System.out.println("Hello")).schedule();
	}
		});
Comment 1 Jay Arthanareeswaran CLA 2017-05-18 01:21:03 EDT
Moving to UI.
Comment 2 Noopur Gupta CLA 2017-05-18 04:31:07 EDT

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