Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabrice Tiercelin2020-07-23 19:49:56 +0000
committerFabrice Tiercelin2020-08-04 06:13:12 +0000
commit4a570634779e5bdf02a718030f84288131446bc6 (patch)
treeed8fdc7bbbee040cdb0429ff82c689afc83d8dfc
parentba3bc6fa85ea480c65efdae3af477b7fafc2297d (diff)
downloadnews-4a570634779e5bdf02a718030f84288131446bc6.tar.gz
news-4a570634779e5bdf02a718030f84288131446bc6.tar.xz
news-4a570634779e5bdf02a718030f84288131446bc6.zip
Bug 562077 - [AutoRefactor immigration #16/133] [cleanup & saveaction]
Use Objects.equals() in the equals method implementation Change-Id: I0a514c10949de504b3b95636a783599147cfb317 Depends-On: Ie4463d947859f2cdcff45c55cf927d870bb6f8b8 Signed-off-by: Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr>
-rw-r--r--4.17/images/objects-equals-after.pngbin0 -> 30366 bytes
-rw-r--r--4.17/images/objects-equals-before.pngbin0 -> 35210 bytes
-rw-r--r--4.17/images/objects-equals-preferences.pngbin0 -> 55876 bytes
-rw-r--r--4.17/jdt.html20
4 files changed, 20 insertions, 0 deletions
diff --git a/4.17/images/objects-equals-after.png b/4.17/images/objects-equals-after.png
new file mode 100644
index 00000000..93338abe
--- /dev/null
+++ b/4.17/images/objects-equals-after.png
Binary files differ
diff --git a/4.17/images/objects-equals-before.png b/4.17/images/objects-equals-before.png
new file mode 100644
index 00000000..e37885c8
--- /dev/null
+++ b/4.17/images/objects-equals-before.png
Binary files differ
diff --git a/4.17/images/objects-equals-preferences.png b/4.17/images/objects-equals-preferences.png
new file mode 100644
index 00000000..f93f220a
--- /dev/null
+++ b/4.17/images/objects-equals-preferences.png
Binary files differ
diff --git a/4.17/jdt.html b/4.17/jdt.html
index 920948be..8f256cb8 100644
--- a/4.17/jdt.html
+++ b/4.17/jdt.html
@@ -82,6 +82,26 @@ ul {padding-left: 13px;}
</p>
</td>
</tr>
+
+ <tr id="objects-equals"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=562077 -->
+ <td class="title">Objects.equals()</td>
+ <td class="content">
+ A new clean up has been added that makes use of <code>Objects.equals()</code> to implement the <code>equals(Object)</code> method.
+ <p>
+ It reduces the code and improves the reading.
+ The cleanup is only available for Java 7 or higher.
+ Although this kind of comparison is almost exclusively seen in the <code>equals(Object)</code> method, it can also reduce code in other methods.
+ </p>
+ <p>
+ To select the clean up, invoke <b>Source &gt; Clean Up...</b>, use a custom profile, and on the <b>Configure...</b> dialog select <b>Use Objects.equals() in the equals method implementation</b> on the <b>Unnecessary Code</b> tab.
+ </p>
+ <p><img src="images/objects-equals-preferences.png" alt="Preferences" width="800 px"/></p>
+ For the given code:
+ <p><img src="images/objects-equals-before.png" alt="Before"/></p>
+ You get this after the clean up:
+ <p><img src="images/objects-equals-after.png" alt="After"/></p>
+ </td>
+ </tr>
<!-- ******************* End of Java Editor ************************************* -->
<!-- ******************* Java Views and Dialogs ************************************* -->

Back to the top