History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-12607
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Alexey Kudravtsev
Reporter: Alexander Chernikov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

Duplicate string literals: introduce constant: improve behaviour if not all occurances are replaced

Created: 13 Dec 06 21:13   Updated: 13 Dec 06 21:13
Component/s: Code Analysis. Duplicates
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 6,595


 Description  « Hide
Get two classes A and B with the same method like:
...
	public static void printMe() {
		//noinspection HardCodedStringLiteral
		System.out.println("Hello.");
	}
...

Duplicate string literals warning is raised for "Hello" entries. Correct. Alt+Enter / Introduce constant. Notice the name of the class in the "Introduce to class" dialog's field. Let it be class A.

Now go to class B. Alt+Enter / Introduce constant on duplicated literal. Class A is suggested. Change to class B. Set "Replace all occurances" OFF (user wants to process just class B). Ok in dialog. Result: new constant is defined in class B, but the only replaced occurance is in class A. Seems to be wrong. If user asks to process the only occurance, (s)he probably thinks about one located in the editor before dialog invocation.

Current behaviour may also produce incompilable code if user chooses private visibility in the dialog.



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.