Bug 570375 - [AutoRefactor immigration #57/149] [cleanup & saveaction]
Unlooped while
Change-Id: I6cf2b8890ce9196dae30731cb340ce9f2971bc92
Signed-off-by: Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr>
Depends-On: Ib370034b8939982a7f3d399b9e227e352d107475
diff --git a/4.19/images/unlooped-while-after.png b/4.19/images/unlooped-while-after.png
new file mode 100644
index 0000000..fc8fc1b
--- /dev/null
+++ b/4.19/images/unlooped-while-after.png
Binary files differ
diff --git a/4.19/images/unlooped-while-before.png b/4.19/images/unlooped-while-before.png
new file mode 100644
index 0000000..e4018fe
--- /dev/null
+++ b/4.19/images/unlooped-while-before.png
Binary files differ
diff --git a/4.19/jdt.html b/4.19/jdt.html
index 1036eba..74ef3fd 100644
--- a/4.19/jdt.html
+++ b/4.19/jdt.html
@@ -296,6 +296,31 @@
</td>
</tr>
+ <tr id="unlooped-while"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=570375 -->
+ <td class="title"><a href="#unlooped-while">Unlooped while</a></td>
+ <td class="content">
+ A new clean up has been added that replaces a <code>while</code> loop that always terminates during the first iteration by an <code>if</code>.
+ <p>
+ The loop should not contain any <code>continue</code> statement.
+ </p>
+ <p>
+ The loop should only contain <code>break</code> statements without statements after.
+ </p>
+ <p>
+ To apply the clean up, select <b>Convert loop into if when possible</b> check box on the <b>Unnecessary code</b> tab in your clean up profile.
+ </p>
+ <p><img src="images/unnecessary-code-preferences.png" alt="Preferences" width="800 px"/></p>
+ <p>
+ For the given code:
+ </p>
+ <p><img src="images/unlooped-while-before.png" alt="Before"/></p>
+ <p>
+ One gets:
+ </p>
+ <p><img src="images/unlooped-while-after.png" alt="After"/></p>
+ </td>
+ </tr>
+
<tr id="source-fixing"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=570773 -->
<td class="title"><a href="#source-fixing">Source Fixing Clean Ups</a></td>
<td class="content">