Bug 571184 - [AutoRefactor immigration #62/149] [cleanup & saveaction]
Object::equals on non null
Change-Id: I9dd8bc0bfc8b02b925c0a8e76cc8933de67febec
Signed-off-by: Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr>
Depends-On: I795af204f8dff26c9ffd0e447b434c472bf050d7
diff --git a/4.19/images/invert-equals-after.png b/4.19/images/invert-equals-after.png
new file mode 100644
index 0000000..8f8fd3f
--- /dev/null
+++ b/4.19/images/invert-equals-after.png
Binary files differ
diff --git a/4.19/images/invert-equals-before.png b/4.19/images/invert-equals-before.png
new file mode 100644
index 0000000..b59cca9
--- /dev/null
+++ b/4.19/images/invert-equals-before.png
Binary files differ
diff --git a/4.19/jdt.html b/4.19/jdt.html
index 800a651..d24b18e 100644
--- a/4.19/jdt.html
+++ b/4.19/jdt.html
@@ -406,6 +406,35 @@
</td>
</tr>
+ <tr id="invert-equals"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=571184 -->
+ <td class="title"><a href="#invert-equals">Object::equals on non null</a></td>
+ <td class="content">
+ A new clean up has been added that inverts calls to <code>Object.equals(Object)</code> and <code>String.equalsIgnoreCase(String)</code> to avoid useless null pointer exception.
+ </p>
+ <p>
+ The caller must be nullable.
+ </p>
+ <p>
+ The parameter must not be nullable.
+ </p>
+ <p>
+ Beware! By avoiding null pointer exceptions, the behavior may change!
+ </p>
+ <p>
+ To apply the clean up, select <b>Avoid Object::equals or String::equalsIgnoreCase on null objects</b> check box on the <b>Source Fixing</b> tab in your clean up profile.
+ </p>
+ <p><img src="images/source-fixing-preferences.png" alt="Preferences" width="800 px"/></p>
+ <p>
+ For the given code:
+ </p>
+ <p><img src="images/invert-equals-before.png" alt="Before"/></p>
+ <p>
+ One gets:
+ </p>
+ <p><img src="images/invert-equals-after.png" alt="After"/></p>
+ </td>
+ </tr>
+
<tr id="comparison-zero"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=570592 -->
<td class="title"><a href="#comparison-zero">Comparison to zero</a></td>
<td class="content">