Modify rule S2251: fix diff-id (#3036)
This commit is contained in:
parent
a630b5dd26
commit
11a2f3acbd
@ -57,7 +57,7 @@ public void doSomething(String [] strings) {
|
|||||||
|
|
||||||
If the intention is to have an infinite loop or a loop terminated only by a break statement, use a `while` or a `do` `while` statement instead.
|
If the intention is to have an infinite loop or a loop terminated only by a break statement, use a `while` or a `do` `while` statement instead.
|
||||||
|
|
||||||
[source,java,diff-id=1,diff-type=noncompliant]
|
[source,java,diff-id=3,diff-type=noncompliant]
|
||||||
----
|
----
|
||||||
for (int i = 0; i < 0; i++) { // Noncompliant, loop is not infinite
|
for (int i = 0; i < 0; i++) { // Noncompliant, loop is not infinite
|
||||||
String event = waitForNextEvent();
|
String event = waitForNextEvent();
|
||||||
@ -68,7 +68,7 @@ for (int i = 0; i < 0; i++) { // Noncompliant, loop is not infinite
|
|||||||
|
|
||||||
==== Compliant solution
|
==== Compliant solution
|
||||||
|
|
||||||
[source,java,diff-id=1,diff-type=compliant]
|
[source,java,diff-id=3,diff-type=compliant]
|
||||||
----
|
----
|
||||||
while (true) { // Compliant
|
while (true) { // Compliant
|
||||||
String event = waitForNextEvent();
|
String event = waitForNextEvent();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user