Bug 569835 - [AutoRefactor immigration #49/146] [cleanup & saveaction]
Use instanceof

Uses an instanceof expression to check an object against a hardcoded
class.

Given:
String isRightType = String.class.isInstance(o);

When:
Clean up the code enabling "Use instanceof"

Then:
String isRightType = (o instanceof String);

Change-Id: I48ea655450a7194b614cf2cbeaa493a137148818
Signed-off-by: Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr>
Depends-On: Id09307b5d191705cd4def68c1b38ed14cec1da30
diff --git a/4.20/images/use-instanceof-after.png b/4.20/images/use-instanceof-after.png
new file mode 100644
index 0000000..02da58d
--- /dev/null
+++ b/4.20/images/use-instanceof-after.png
Binary files differ
diff --git a/4.20/images/use-instanceof-before.png b/4.20/images/use-instanceof-before.png
new file mode 100644
index 0000000..31ed5e5
--- /dev/null
+++ b/4.20/images/use-instanceof-before.png
Binary files differ
diff --git a/4.20/images/use-instanceof-preferences.png b/4.20/images/use-instanceof-preferences.png
new file mode 100644
index 0000000..0d2f978
--- /dev/null
+++ b/4.20/images/use-instanceof-preferences.png
Binary files differ
diff --git a/4.20/jdt.html b/4.20/jdt.html
index dd7caf9..a4dca85 100644
--- a/4.20/jdt.html
+++ b/4.20/jdt.html
@@ -73,6 +73,28 @@
     </td>
   </tr>
   
+  <tr id="use-instanceof"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=569835 -->
+    <td class="title"><a href="#use-instanceof">Use instanceof</a></td>
+    <td class="content">
+      A new clean up has been added that uses an <code>instanceof</code> expression to check an object against a hardcoded class.
+      <p>
+        The expression must be a supertype of the targeted class.
+      </p>
+      <p>
+        To apply the clean up, select <b>Use instanceof keyword instead of Class.isInstance()</b> check box on the <b>Code Style</b> tab in your clean up profile.
+      </p>
+      <p><img src="images/use-instanceof-preferences.png" alt="Preferences" width="800"/></p>
+      <p>
+        For the given code:
+      </p>
+      <p><img src="images/use-instanceof-before.png" alt="Before"/></p>
+      <p>
+        One gets:
+      </p>
+      <p><img src="images/use-instanceof-after.png" alt="After"/></p>
+    </td>
+  </tr>
+  
   <tr id="operand-factorization"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=569666 -->
     <td class="title"><a href="#operand-factorization">Operand factorization clean up</a></td>
     <td class="content">