forked from checkstyle/checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue checkstyle#3546: add lambda in a rightcurlycheck
- Loading branch information
Showing
7 changed files
with
169 additions
and
10 deletions.
There are no files selected for viewing
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
30 changes: 30 additions & 0 deletions
30
.../checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyAloneLambda.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,30 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.blocks; | ||
|
||
/*Test lambda*/ | ||
public class InputRightCurlyAloneLambda { | ||
|
||
static Runnable k1 = () -> { | ||
String.valueOf("Test rightCurly 1!"); | ||
}; | ||
|
||
static Runnable k2 = () -> String.valueOf("Test rightCurly 2!"); | ||
|
||
static Runnable k3 = () -> {String.valueOf("Test rightCurly 3!");}; // violation | ||
|
||
static Runnable k4 = () -> { | ||
String.valueOf("Test rightCurly 4!");}; // violation | ||
|
||
static Runnable k5 = () -> | ||
{ | ||
String.valueOf("Test rightCurly 5!"); | ||
}; | ||
|
||
static Runnable k6 = () -> {}; // violation | ||
|
||
static Runnable k7 = () -> { | ||
}; | ||
|
||
static Runnable k8 = () -> | ||
{ | ||
}; | ||
} |
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
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
32 changes: 32 additions & 0 deletions
32
...resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputRightCurlyAloneInLambda.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,32 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.blocks; | ||
|
||
/* | ||
This is test class for token LAMBDA. | ||
*/ | ||
public class InputRightCurlyAloneInLambda { | ||
|
||
static Runnable r1 = () -> { | ||
String.valueOf("Test rightCurly one!"); | ||
}; | ||
|
||
static Runnable r2 = () -> String.valueOf("Test rightCurly two!"); | ||
|
||
static Runnable r3 = () -> {String.valueOf("Test rightCurly two!");}; //violation | ||
|
||
static Runnable r4 = () -> { | ||
String.valueOf("Test rightCurly three!");}; //violation | ||
|
||
static Runnable r5 = () -> | ||
{ | ||
String.valueOf("Test rightCurly five!"); | ||
}; | ||
|
||
static Runnable r6 = () -> {}; //violation | ||
|
||
static Runnable r7 = () -> { | ||
}; | ||
|
||
static Runnable r8 = () -> | ||
{ | ||
}; | ||
} |
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