Bug 436677 - [1.8][refactoring][convert local] Convert local variable to field not handled for lambda parameters
Summary: [1.8][refactoring][convert local] Convert local variable to field not handled...
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-05 05:58 EDT by Noopur Gupta CLA
Modified: 2020-03-20 12:10 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Noopur Gupta CLA 2014-06-05 05:58:34 EDT
package bug;

@FunctionalInterface
interface FI {
	int foo (int x);
}

class T {
	private void foo() {
		FI fi1 = a -> { // [1]-caret before 'a'. [2]-select 'a'
			int x = a;
			return a;
		};
		FI fi2 = (int a) -> { // [3]
			int x = fi1.foo(0);
			return a;
		};
	}

	private void bar(FI fi) {}
}
------------------------------------------------------------------

In the above example, invoke "Convert local variable to field" via Refactor menu.
[1] converts 'fi1' to field.
[2] & [3] result in the following exception:

java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:423)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:331)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish(RefactoringWizard.java:637)
	at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish(UserInputWizardPage.java:153)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish(RefactoringWizard.java:710)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.okPressed(RefactoringWizardDialog2.java:455)
	at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:466)
...
Caused by: org.eclipse.core.runtime.AssertionFailedException: assertion failed: 
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
	at org.eclipse.jdt.internal.corext.refactoring.code.PromoteTempToFieldRefactoring.addLocalDeclarationRemoval(PromoteTempToFieldRefactoring.java:815)
	at org.eclipse.jdt.internal.corext.refactoring.code.PromoteTempToFieldRefactoring.createChange(PromoteTempToFieldRefactoring.java:541)
Comment 1 Eclipse Genie CLA 2020-03-20 12:10:41 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.