Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabrice Tiercelin2020-11-18 06:37:56 +0000
committerFabrice Tiercelin2020-11-18 06:38:23 +0000
commit9b83037d76ed2c46000e5c7c26dafc5998e0f01c (patch)
tree9bbb9847be357d2898316595823866ff54c13405
parentf238145a0530acbe0c6fa8da753f763b950203ca (diff)
downloadnews-9b83037d76ed2c46000e5c7c26dafc5998e0f01c.tar.gz
news-9b83037d76ed2c46000e5c7c26dafc5998e0f01c.tar.xz
news-9b83037d76ed2c46000e5c7c26dafc5998e0f01c.zip
Bug 567692 - [AutoRefactor immigration #31/138] [cleanup & saveaction]
Objects.hash() Change-Id: I4e594dbc06b9ff696628c8b84ab724758cde6495 Signed-off-by: Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr> Depends-On: Ia3bb7a33197ddd6d1f6a63689252634320a05e4f
-rw-r--r--4.18/images/hash-after.pngbin0 -> 23893 bytes
-rw-r--r--4.18/images/hash-before.pngbin0 -> 18422 bytes
-rw-r--r--4.18/jdt.html25
3 files changed, 25 insertions, 0 deletions
diff --git a/4.18/images/hash-after.png b/4.18/images/hash-after.png
new file mode 100644
index 00000000..f3be0a74
--- /dev/null
+++ b/4.18/images/hash-after.png
Binary files differ
diff --git a/4.18/images/hash-before.png b/4.18/images/hash-before.png
new file mode 100644
index 00000000..0a656057
--- /dev/null
+++ b/4.18/images/hash-before.png
Binary files differ
diff --git a/4.18/jdt.html b/4.18/jdt.html
index c9d9dcbb..6609ed10 100644
--- a/4.18/jdt.html
+++ b/4.18/jdt.html
@@ -228,6 +228,31 @@ ul {padding-left: 13px;}
</td>
</tr>
+ <tr id="hash"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=567692 -->
+ <td class="title"><a href="#hash">Use Objects.hash()</a></td>
+ <td class="content">
+ A new clean up has been added that rewrites Eclipse-autogenerated <code>hashCode()</code> method by Eclipse-autogenerated <code>hashCode()</code> method for Java 7 using <code>Objects.hash()</code>.
+ <p>
+ Let's remind that you can autogenerate your <code>hashCode()</code> and <code>equals()</code> methods by right-clicking on your class, selecting <b>Source</b> and clicking on <b>Generate hashCode() and equals() methods...</b>.
+ Since Eclipse 2018-09, <a href="https://www.eclipse.org/eclipse/news/4.9/jdt.php#java7-hashcode-equals">a checkbox allows you to generate your methods using Java 7 API</a>. This cleanup rewrites your method as if it has been generated using this option.
+ </p>
+ <p>
+ This clean up does not generate again your method from scratch, it rewrites it using a more modern syntax. That is to say, if your method is missing or voluntary does not process a field, this field still won't be processed.
+ </p>
+ <p>
+ To apply 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.hash()</b> check box on the <b>Unnecessary Code</b> tab.
+ </p>
+ <p>
+ For the given code:
+ </p>
+ <p><img src="images/hash-before.png" alt="Before"/></p>
+ <p>
+ One gets:
+ </p>
+ <p><img src="images/hash-after.png" alt="After"/></p>
+ </td>
+ </tr>
+
<tr id="arrays-fill"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=567264 -->
<td class="title"><a href="#arrays-fill">Use Arrays.fill()</a></td>
<td class="content">

Back to the top