- Start IntelliJ IDEA and open the comparingReferences plugin project saved into the <%IDEA project folder%>/community/samples/comparingReferences directory.
- 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.
- Run the plugin by choosing the Run | Run on the main menu.
If necessary, change the Run/Debug Configurations .
Configuring the Plugin
Once the plugin is launced, you can set the plugin options.
To configure the sample plugin
- In the IDEA main menu, choose File | Settings, and then under Project Settings click Inspections.
- In the list of the IntelliJ IDEA inspections, expand the Probable bugs node, and then click '==' or '!=' instead of 'equals()'.
- Under Options, you can specify the following plugin settings:
How It Works?
The plugin inspects your code opened in the IntelliJ 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():
Testing the Plugin
The sample plugin contains the
TestThisPlugin Java class in the testSource/testPlugin package and the test data in the <plugin directory>/testData directory.
The test program covers two test cases. To perform the plugin test, run the