-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #4092: added extends, implements and annotations processing
- Loading branch information
Showing
9 changed files
with
191 additions
and
57 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
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
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
93 changes: 93 additions & 0 deletions
93
...heckstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityAnnotations.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,93 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Target; | ||
|
||
import com.puppycrawl.tools.checkstyle.api.TokenTypes; | ||
|
||
/* This input file is intended to be used on strict configuration: max=0 */ | ||
public class InputClassFanOutComplexityAnnotations { // violation | ||
|
||
private int tokenType = TokenTypes.EXPR; | ||
|
||
public void foo1(@TypeAnnotation char a) {} | ||
|
||
public void foo2(final char @TypeAnnotation [] a) {} | ||
|
||
@MethodAnnotation | ||
public void foo3() {} | ||
|
||
@Override | ||
public String toString() { | ||
return super.toString(); | ||
} | ||
|
||
@MyAnnotation // violation | ||
public class InnerClass { | ||
|
||
@MyAnnotation | ||
@MethodAnnotation | ||
public void innerClassMethod() {} | ||
|
||
} | ||
|
||
public class InnerClass2 { // violation | ||
|
||
@MethodAnnotation | ||
@MyAnnotation | ||
public String innerClass2Method(@TypeAnnotation String parameter) { | ||
return parameter.trim(); | ||
} | ||
|
||
} | ||
|
||
public class InnerClass3 { // violation | ||
|
||
@TypeAnnotation | ||
private final String warningsType = "boxing"; | ||
|
||
@MyAnnotation | ||
@SuppressWarnings(value = warningsType) | ||
public String innerClass3Method() { | ||
return new Integer(5).toString(); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
class OuterClass { // violation | ||
|
||
private static final String name = "1"; | ||
|
||
private static final String value = "4"; | ||
|
||
@TwoParametersAnnotation(value = "4", tokenType = 1) | ||
public static final String EMPTY_STRING = ""; | ||
|
||
@TwoParametersAnnotation(value = value, tokenType = TokenTypes.ANNOTATION) | ||
public static final String TAB = "\t"; | ||
|
||
} | ||
|
||
@Target(ElementType.TYPE_USE) | ||
@interface TypeAnnotation {} | ||
|
||
@Target(ElementType.METHOD) | ||
@interface MethodAnnotation {} | ||
|
||
@MyAnnotation // violation | ||
class MyClass {} | ||
|
||
@MyAnnotation // violation | ||
interface MyInterface {} | ||
|
||
@interface MyAnnotation {} | ||
|
||
@interface TwoParametersAnnotation { | ||
|
||
String value(); | ||
|
||
int tokenType(); | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
...ls/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExtends.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,6 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity; | ||
|
||
public class InputClassFanOutComplexityExtends extends ParentClass { | ||
} | ||
|
||
class ParentClass {} |
5 changes: 5 additions & 0 deletions
5
...checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityImplements.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,5 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity; | ||
|
||
public class InputClassFanOutComplexityImplements implements Interface {} | ||
|
||
interface Interface {} |
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