Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Start IntelliJ IDEA and open the comparingReferences plugin project saved into the <%IDEA project folder%>/community/samples/comparingReferences directory.
  2. Ensure that the project settings are valid for your environment. If necessary, modify the project settings.
    To view or modify the project settings, on the toolbar, click , and then complete the Project Structure dialog box that opens.
  3. Run the plugin by choosing the Run | Run on the main menu.
    If necessary, change the Run/Debug Configurations .

How It Works?

The plugin inspects your code opened in the IDEA editor or the code you are typing. The plugin highlights the code fragments where two variables of the reference type are separated by == or != and proposes to replace this code fragment with *.equals():

Image Added

In this example, the code:

Code Block
return (n>=0) ? n : -n;

will be replaced with the code:

Code Block

if ((n>=0)) {
            return n;
        } else {
            return -n;
        }