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#13345: Enable examples tests for AnonInnerLengthCheck
- Loading branch information
1 parent
7e5c3c6
commit c54f4ca
Showing
7 changed files
with
144 additions
and
38 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
33 changes: 33 additions & 0 deletions
33
...ples/resources/com/puppycrawl/tools/checkstyle/checks/sizes/anoninnerlength/Example1.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,33 @@ | ||
/*xml | ||
<module name="Checker"> | ||
<module name="TreeWalker"> | ||
<module name="AnonInnerLength"/> | ||
</module> | ||
</module> | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.checks.sizes.anoninnerlength; | ||
|
||
// xdoc section -- start | ||
class Example1 { | ||
void testMethod() { | ||
Runnable shortAnonClass = new Runnable() { | ||
@Override | ||
public void run() { | ||
System.out.println("Short anonymous class."); | ||
} | ||
}; | ||
shortAnonClass.run(); | ||
|
||
Runnable longAnonClass = new Runnable() { | ||
@Override | ||
public void run() { | ||
System.out.println("This is a lengthy anonymous class."); | ||
System.out.println("It has too many lines of code."); | ||
System.out.println("Exceeding the length limit."); | ||
System.out.println("This would trigger the AnonInnerLength rule."); | ||
} | ||
}; | ||
longAnonClass.run(); | ||
} | ||
} | ||
// xdoc section -- end |
10 changes: 0 additions & 10 deletions
10
...mples/resources/com/puppycrawl/tools/checkstyle/checks/sizes/anoninnerlength/Example1.txt
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
...ples/resources/com/puppycrawl/tools/checkstyle/checks/sizes/anoninnerlength/Example2.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,35 @@ | ||
/*xml | ||
<module name="Checker"> | ||
<module name="TreeWalker"> | ||
<module name="AnonInnerLength"> | ||
<property name="max" value="7"/> | ||
</module> | ||
</module> | ||
</module> | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.checks.sizes.anoninnerlength; | ||
|
||
// xdoc section -- start | ||
class Example2 { | ||
void testMethod() { | ||
Runnable shortAnonClass = new Runnable() { | ||
@Override | ||
public void run() { | ||
System.out.println("Short anonymous class."); | ||
} | ||
}; | ||
shortAnonClass.run(); | ||
// violation below, 'Anonymous inner class length is 9 lines (max allowed is 7)' | ||
Runnable longAnonClass = new Runnable() { | ||
@Override | ||
public void run() { | ||
System.out.println("This is a lengthy anonymous class."); | ||
System.out.println("It has too many lines of code."); | ||
System.out.println("Exceeding the length limit."); | ||
System.out.println("This would trigger the AnonInnerLength rule."); | ||
} | ||
}; | ||
longAnonClass.run(); | ||
} | ||
} | ||
// xdoc section -- end |
12 changes: 0 additions & 12 deletions
12
...mples/resources/com/puppycrawl/tools/checkstyle/checks/sizes/anoninnerlength/Example2.txt
This file was deleted.
Oops, something went wrong.
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