Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319722 - [clean up] Provide refactoring option for converting var.equals(const) to const.equals(var)
Summary: [clean up] Provide refactoring option for converting var.equals(const) to con...
Status: CLOSED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-13 09:57 EDT by Ankur Sharma CLA
Modified: 2010-07-13 11:21 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 Ankur Sharma CLA 2010-07-13 09:57:57 EDT
This goes specially for String type

Provide a refactoring option for converting the condition tests

variable.equals(SOME_CONSTANT) to SOME_CONSTANT.equals(variables)

This is also help quickly fixing some of the NPEs.
Comment 1 Markus Keller CLA 2010-07-13 10:45:55 EDT
We already have a Quick Assist (Ctrl+1) called "Invert equals" that helps doing this manually.

Doing this automatically for a whole project is dangerous, since it doesn't have to be semantically preserving. You never know how equals(..) is implemented in the two involved types, and some code could even expect to get NPEs.

If we implement this, it will most likely be a Clean Up, not a Refactoring.
Comment 2 Ankur Sharma CLA 2010-07-13 11:21:22 EDT
I did not know this. In fact, I thought Ctrl+1 works only on problem markers. It is good enough for me.