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

Bug 367672

Summary: [quick assist] [inline] Support Inline Constant refactoring in Quick Assist
Product: [Eclipse Project] JDT Reporter: Mohsen Vakilian <reprogrammer>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad, markus.kell.r, reprogrammer
Version: 3.8   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Mohsen Vakilian CLA 2011-12-30 15:08:20 EST
Build id: I20111207-2118

The Quick Assist menu supports refactorings such as Extract Local Variable, Inline Local Variable, and Extract Constant but not Inline Constant.

One of the results of the CodingSpectator <http://codingspectator.cs.illinois.edu/> study was that Quick Assist is a preferred method of invoking refactorings. I think that adding Inline Constant to Quick Assist would be a natural extension of Quick Assist. However, I didn't find any bug reports on this issue. So, I decided to open one.

Steps to Reproduce:

1. Add a class called "C" with the following contents to a Java project:
---
// C.java
public class C {
	
	private static final int CONSTANT = 1;

	void m() {
		System.out.println(CONSTANT);
	}
	
}

---
2. Select "CONSTANT" either in the declaration or use of the constant and press "CTRL+1". The Quick Assist menu will open but won't propose the Inline Constant refactoring.

This feature request is similar to Bug 367671.
Comment 1 Deepak Azad CLA 2012-01-01 09:58:22 EST
Makes sense. We already have a 'Inline local variable' quick assist, and I do
not see any reason to not add a 'Inline constant' quick assist.

Fix would be similar to QuickAssistProcessor.getInlineLocalProposal(...)
Comment 2 Markus Keller CLA 2012-04-13 11:29:48 EDT
Quick Assist/Fix actions are intended to be quick local actions that only change a single file. We won't add refactorings as quick assists if they touch more than one file.

We could do something like bug 354147, but just adding all commands one by
one as quick assist is not a good strategy.