forked from checkstyle/checkstyle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue checkstyle#3333: add new literals in WhiteSpaceAfterCheck
- Loading branch information
Showing
7 changed files
with
200 additions
and
5 deletions.
There are no files selected for viewing
Empty file modified
0
src/main/java/com/puppycrawl/tools/checkstyle/api/TokenTypes.java
100644 → 100755
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file modified
0
src/test/java/com/puppycrawl/tools/checkstyle/grammars/GeneratedJavaTokenTypesTest.java
100644 → 100755
Empty file.
20 changes: 20 additions & 0 deletions
20
src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/InputDoWhile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.whitespace; | ||
|
||
public class InputDoWhile { | ||
|
||
boolean condition() { | ||
return false; | ||
} | ||
|
||
void testDoWhile() { | ||
//Valid | ||
do { | ||
testDoWhile(); | ||
} while (condition()); | ||
|
||
//Invalid | ||
do { | ||
testDoWhile(); | ||
} while(condition()); //violation | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...est/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/InputWhitespaceAfter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.whitespace; | ||
|
||
public class InputWhitespaceAfter { | ||
|
||
boolean condition() { | ||
return false; | ||
} | ||
|
||
void testIfElse() { | ||
//Valid | ||
if (condition()) { | ||
testIfElse(); | ||
} else { | ||
testIfElse(); | ||
} | ||
|
||
//Invalid | ||
if(condition()) { //violation | ||
testIfElse(); | ||
} else { | ||
testIfElse(); | ||
} | ||
|
||
//Invalid | ||
if (condition()) { | ||
testIfElse(); | ||
} else{ //violation | ||
testIfElse(); | ||
} | ||
} | ||
|
||
void testWhile() { | ||
//Valid | ||
while (condition()) { | ||
testWhile(); | ||
} | ||
|
||
//Invalid | ||
while(condition()) { //violation | ||
testWhile(); | ||
} | ||
} | ||
|
||
void testFor() { | ||
//Valid | ||
for (int i = 0; i < 5; i++) { | ||
testFor(); | ||
} | ||
|
||
//Invalid | ||
for(int i = 0; i < 5; i++) { //violation | ||
testFor(); | ||
} | ||
} | ||
|
||
void testDo() { | ||
//Valid | ||
do { | ||
testDo(); | ||
} while (condition()); | ||
|
||
//Invalid | ||
do{ //violation | ||
testDo(); | ||
} while (condition()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters