diff options
author | Aurimas Liutikas <aurimas@google.com> | 2017-11-28 20:29:59 -0800 |
---|---|---|
committer | Aurimas Liutikas <aurimas@google.com> | 2017-11-28 20:29:59 -0800 |
commit | b4aec831a096b89efed151c9b2c5754d9491e6ea (patch) | |
tree | f8c04870544dda72e99139fcc713a66b04514dcc /src/test/resources/com/puppycrawl/tools/checkstyle/checks | |
parent | b8aa773e4886dabd0ffc5026420edd061069f044 (diff) | |
parent | dbbd00f58fd36c7c23e24e6652076b735b8e7c0c (diff) | |
download | checkstyle-b4aec831a096b89efed151c9b2c5754d9491e6ea.tar.gz |
Merge Checkstyle 8.5 into aosp/master
Test: None
Diffstat (limited to 'src/test/resources/com/puppycrawl/tools/checkstyle/checks')
201 files changed, 1935 insertions, 168 deletions
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/annotation/annotationonsameline/InputAnnotationOnSameLineCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/annotation/annotationonsameline/InputAnnotationOnSameLineCheck.java new file mode 100644 index 000000000..d24c94b38 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/annotation/annotationonsameline/InputAnnotationOnSameLineCheck.java @@ -0,0 +1,26 @@ +package com.puppycrawl.tools.checkstyle.checks.annotation.annotationonsameline; + +public class InputAnnotationOnSameLineCheck { + + @Annotation int x; + + int y; + + @Annotation + @SomeClass.Annotation + @java.lang.Deprecated + public int getX() { + return (int) x; + } + +} + +class SomeClass { + + @interface Annotation { + } + +} + +@interface Annotation { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/annotation/annotationonsameline/InputAnnotationOnSameLineCheck2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/annotation/annotationonsameline/InputAnnotationOnSameLineCheck2.java new file mode 100644 index 000000000..ccb066193 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/annotation/annotationonsameline/InputAnnotationOnSameLineCheck2.java @@ -0,0 +1,37 @@ +package com.puppycrawl.tools.checkstyle.checks.annotation.annotationonsameline; + +import static java.lang.annotation.ElementType.*; + +import java.lang.annotation.Target; +import java.util.List; +import java.util.ArrayList; + +public class InputAnnotationOnSameLineCheck2 { + + @Ann + private List<String> names = new ArrayList<>(); + + @Ann private List<String> names2 = new ArrayList<>(); + + @SuppressWarnings("deprecation") + @Ann Integer x; + + @SuppressWarnings("deprecation") + @Ann + Integer x2; + + @SuppressWarnings("deprecation") @Ann @Ann2 @Ann3 @Ann4 Integer x3; + +} + +@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER, TYPE, TYPE_PARAMETER, TYPE_USE}) @interface Ann { +} + +@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER, TYPE, TYPE_PARAMETER, TYPE_USE}) @interface Ann2 { +} + +@interface Ann3 { +} + +@interface Ann4 { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/annotation/annotationonsameline/InputAnnotationOnSameLineCheckOnDifferentTokens.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/annotation/annotationonsameline/InputAnnotationOnSameLineCheckOnDifferentTokens.java new file mode 100644 index 000000000..dd966778c --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/annotation/annotationonsameline/InputAnnotationOnSameLineCheckOnDifferentTokens.java @@ -0,0 +1,59 @@ +package com.puppycrawl.tools.checkstyle.checks.annotation.annotationonsameline; + +import java.util.List; + +@Ann +@Ann2 interface TestInterface { + + @Ann + @Ann2 Integer getX(); + +} + +public @Ann +@Ann2 class InputAnnotationOnSameLineCheckOnDifferentTokens implements @Ann + @Ann2 TestInterface { + + @Ann + @Ann2 private Integer x = new @Ann + @Ann2 Integer(0); + + private List<@Ann + @Ann2 Integer> integerList; + + @Ann + @Ann2 enum TestEnum { + A1, A2 + } + + @Ann + @Ann2 public InputAnnotationOnSameLineCheckOnDifferentTokens() { + } + + @Ann + @Ann2 public void setX(@Ann + @Ann2 int x) throws @Ann + @Ann2 Exception { + this.<@Ann + @Ann2 Integer> getXAs(); + this.x = x; + } + + @Override public Integer getX() { + return (@Ann + @Ann2 Integer) x; + } + + public <T> T getXAs() { + return (T) x; + } + +} + +@Ann +@Ann2 @interface TestAnnotation { + + @Ann + @Ann2 int x(); + +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/arraytypestyle/InputArrayTypeStyle.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/arraytypestyle/InputArrayTypeStyle.java index c64f6377c..6dd83fb43 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/arraytypestyle/InputArrayTypeStyle.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/arraytypestyle/InputArrayTypeStyle.java @@ -2,7 +2,7 @@ // Test case file for checkstyle. // Created: 2001 //////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle.checks.misc.arraytypestyle; +package com.puppycrawl.tools.checkstyle.checks.arraytypestyle; /** * Test case for ArrayTypeStyle (Java vs C) @@ -12,6 +12,7 @@ public class InputArrayTypeStyle { private int[] javaStyle = new int[0]; private int cStyle[] = new int[0]; + private int c[] = new int[0]; public static void mainJava(String[] aJavaStyle) { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/avoidescapedunicodecharacters/InputAvoidEscapedUnicodeCharacters.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/avoidescapedunicodecharacters/InputAvoidEscapedUnicodeCharacters.java index 58c25ff43..f13bd870b 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/avoidescapedunicodecharacters/InputAvoidEscapedUnicodeCharacters.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/avoidescapedunicodecharacters/InputAvoidEscapedUnicodeCharacters.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.avoidescapedunicodecharacters; +package com.puppycrawl.tools.checkstyle.checks.avoidescapedunicodecharacters; import java.util.concurrent.TimeUnit; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/avoidescapedunicodecharacters/InputAllEscapedUnicodeCharacters.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/avoidescapedunicodecharacters/InputAvoidEscapedUnicodeCharactersAllEscapedUnicodeCharacters.java index 435e32acc..f48b52cf3 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/avoidescapedunicodecharacters/InputAllEscapedUnicodeCharacters.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/avoidescapedunicodecharacters/InputAvoidEscapedUnicodeCharactersAllEscapedUnicodeCharacters.java @@ -1,6 +1,6 @@ package com.puppycrawl.tools.checkstyle.checks; -public class InputAllEscapedUnicodeCharacters { +public class InputAvoidEscapedUnicodeCharactersAllEscapedUnicodeCharacters { private String[] allEscapedUnicodeCharacters = { "" /* control character ok */ + "\u0000" diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/declarationorder/InputDeclarationOrder.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/declarationorder/InputDeclarationOrder.java index 7ddbb89fe..9c0303b80 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/declarationorder/InputDeclarationOrder.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/declarationorder/InputDeclarationOrder.java @@ -40,6 +40,13 @@ public class InputDeclarationOrder foo += INNER_FOO3; } + public InnerClass(int start) + { + int foo = start; + foo += INNER_FOO2; + foo += INNER_FOO3; + } + // error member variables should be before methods or ctors // error public before private public static final int INNER_FOO3 = 2; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/defaultcomeslast/InputSkipIfLastAndSharedWithCase.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/defaultcomeslast/InputDefaultComesLastSkipIfLastAndSharedWithCase.java index aa9435b6e..ccfed68af 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/defaultcomeslast/InputSkipIfLastAndSharedWithCase.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/defaultcomeslast/InputDefaultComesLastSkipIfLastAndSharedWithCase.java @@ -1,7 +1,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding.defaultcomeslast; -public class InputSkipIfLastAndSharedWithCase +public class InputDefaultComesLastSkipIfLastAndSharedWithCase { void method(int i) { switch (i) { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/equalsavoidnull/InputEqualsAvoidNullNested.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/equalsavoidnull/InputEqualsAvoidNullNested.java new file mode 100644 index 000000000..2a1a320da --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/equalsavoidnull/InputEqualsAvoidNullNested.java @@ -0,0 +1,27 @@ +package com.puppycrawl.tools.checkstyle.checks.coding.equalsavoidnull; + +import java.io.IOException; +import java.io.Reader; + +public class InputEqualsAvoidNullNested { + public void foo(Reader in) throws IOException { + int c; + while(true) { + c = in.read(); + if (c == -1) + break; + + if (c == '<') { + c = in.read(); + if (c == '/') { + String nm = in.toString(); + if (nm.equalsIgnoreCase("applet") || + nm.equalsIgnoreCase("object") || + nm.equalsIgnoreCase("embed")) { + break; + } + } + } + } + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/equalsavoidnull/InputEqualsAvoidNullOnTheSameLine.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/equalsavoidnull/InputEqualsAvoidNullOnTheSameLine.java new file mode 100644 index 000000000..dc4783bbb --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/equalsavoidnull/InputEqualsAvoidNullOnTheSameLine.java @@ -0,0 +1,9 @@ +package com.puppycrawl.tools.checkstyle.checks.coding.equalsavoidnull; + +public class InputEqualsAvoidNullOnTheSameLine { + + static { + String b = "onion"; + String a=b;a.equals("ONION"); + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/explicitinitialization/InputExplicitInitialization.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/explicitinitialization/InputExplicitInitialization.java index d63024d50..111d19f49 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/explicitinitialization/InputExplicitInitialization.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/explicitinitialization/InputExplicitInitialization.java @@ -79,4 +79,5 @@ class Chars { char b = a; byte c = 1; short d = 1; + final long e = 0; } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/fallthrough/InputFallThrough.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/fallthrough/InputFallThrough.java index 4486bbd03..a3c745e55 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/fallthrough/InputFallThrough.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/fallthrough/InputFallThrough.java @@ -521,4 +521,30 @@ public class InputFallThrough public void close() throws Exception { } } + + void synchronizedStatement() { + switch (hashCode()) { + case 1: + synchronized (this) { + break; + } + case 2: + // synchronized nested in if + if (true) { + synchronized (this) { + break; + } + } else { + synchronized (this) { + break; + } + } + case 3: + synchronized (this) { + } + // fallthru + default: + break; + } + } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/finallocalvariable/InputFinalLocalVariableAnonymousClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/finallocalvariable/InputFinalLocalVariableAnonymousClass.java new file mode 100644 index 000000000..67177632e --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/finallocalvariable/InputFinalLocalVariableAnonymousClass.java @@ -0,0 +1,14 @@ +package com.puppycrawl.tools.checkstyle.checks.coding.finallocalvariable; + +public class InputFinalLocalVariableAnonymousClass { + public void test() { + Object testSupport = new Object() { + @Override + public String toString() { + final String dc = new String(); + return dc; + } + }; + testSupport.toString(); + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegaltype/InputIllegalTypeSameFileName.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegaltype/InputIllegalTypeSameFileName.java index b39ece624..8735f5392 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegaltype/InputIllegalTypeSameFileName.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegaltype/InputIllegalTypeSameFileName.java @@ -26,4 +26,7 @@ public class InputIllegalTypeSameFileName } java.util.List<Integer> list = new ArrayList<>(); //WARNING private ArrayList<String> values; + private Boolean d; //WARNING + private Boolean[] d1; //WARNING + private Boolean[][] d2; //WARNING } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegaltype/InputIllegalTypeSimilarClassName.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegaltype/InputIllegalTypeSimilarClassName.java new file mode 100644 index 000000000..704a9e92f --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegaltype/InputIllegalTypeSimilarClassName.java @@ -0,0 +1,8 @@ +package com.puppycrawl.tools.checkstyle.checks.coding.illegaltype; + +public class InputIllegalTypeSimilarClassName { + private TreeSet example; + + private static class TreeSet { + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/modifiedcontrolvariable/InputModifiedControlVariableEnhancedForLoopVariable2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/modifiedcontrolvariable/InputModifiedControlVariableEnhancedForLoopVariable2.java new file mode 100644 index 000000000..9c4685397 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/modifiedcontrolvariable/InputModifiedControlVariableEnhancedForLoopVariable2.java @@ -0,0 +1,18 @@ +package com.puppycrawl.tools.checkstyle.checks.coding.modifiedcontrolvariable; + +public class InputModifiedControlVariableEnhancedForLoopVariable2 { + void m(int[] a) { + for (int i = 0, j = 1; ; i++, j++) { + for (int k : a) { + } + } + } + + void m2(int[] a) { + for (int i = 0, j = 1; ; i++, j++) { + for (int k : a) { + i++; + } + } + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/multiplestringliterals/InputMultipleStringLiteralsNoWarnings.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/multiplestringliterals/InputMultipleStringLiteralsNoWarnings.java new file mode 100644 index 000000000..f33d30bb4 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/multiplestringliterals/InputMultipleStringLiteralsNoWarnings.java @@ -0,0 +1,5 @@ +package com.puppycrawl.tools.checkstyle.checks.coding.multiplestringliterals; + +public class InputMultipleStringLiteralsNoWarnings { + private final String m4 = "" + ""; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/overloadmethoddeclaration/InputOverloadMethodsDeclarationOrder.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/overloadmethodsdeclarationorder/InputOverloadMethodsDeclarationOrder.java index b56dd4fcc..2aa3520db 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/overloadmethoddeclaration/InputOverloadMethodsDeclarationOrder.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/overloadmethodsdeclarationorder/InputOverloadMethodsDeclarationOrder.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.coding.overloadmethoddeclaration; +package com.puppycrawl.tools.checkstyle.checks.coding.overloadmethodsdeclarationorder; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/requirethis/InputRequireThisCaseGroup.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/requirethis/InputRequireThisCaseGroup.java new file mode 100644 index 000000000..b32b99c58 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/requirethis/InputRequireThisCaseGroup.java @@ -0,0 +1,48 @@ +package com.puppycrawl.tools.checkstyle.checks.coding.requirethis; + +public class InputRequireThisCaseGroup { + private String aVariable; + + public String method1(int val) { + switch (val) { + case 0: + String aVariable = ""; + + if (this.aVariable != null) { + aVariable = this.aVariable; + } + + return aVariable; + default: + return null; + } + } + + public String method2(int val) { + switch (val) { + case 0: + String aVariable = ""; + + if (this.aVariable != null) { + aVariable = this.aVariable; + } + + return aVariable; + } + return null; + } + + public String method3(int val) { + switch (val) { + case 0: + String other = ""; + + if (aVariable != null) { + other = aVariable; + } + + return other; + } + return null; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/requirethis/InputRequireThisExtendedMethod.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/requirethis/InputRequireThisExtendedMethod.java new file mode 100644 index 000000000..c7202c645 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/requirethis/InputRequireThisExtendedMethod.java @@ -0,0 +1,10 @@ +package com.github.sevntu.checkstyle.checks.coding; + +import java.util.logging.Logger; + +public class InputRequireThisExtendedMethod +{ + public class Check { + private Logger log1 = Logger.getLogger(getClass().getName()); + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/superclone/InputSuperCloneWithoutWarnings.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/superclone/InputSuperCloneWithoutWarnings.java new file mode 100644 index 000000000..afc0740c3 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/superclone/InputSuperCloneWithoutWarnings.java @@ -0,0 +1,8 @@ +package com.puppycrawl.tools.checkstyle.checks.coding.superclone; + +public class InputSuperCloneWithoutWarnings { + @Override + protected final Object clone() throws CloneNotSupportedException { + return new InputSuperCloneWithoutWarnings(); + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessaryparentheses/InputUnnecessaryParenthesesLambdas.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessaryparentheses/InputUnnecessaryParenthesesLambdas.java new file mode 100644 index 000000000..2d901fae5 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessaryparentheses/InputUnnecessaryParenthesesLambdas.java @@ -0,0 +1,79 @@ +package com.puppycrawl.tools.checkstyle.checks.coding.unnecessaryparentheses; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.Objects; +import java.util.function.Function; + +public class InputUnnecessaryParenthesesLambdas { + int foo(int y) { + MathOperation case1 = (x) -> x + x; + MathOperation case2 = (x) -> { return x + x; }; + MathOperation case3 = (int x) -> x + x; + MathOperation case4 = x -> x + x; + MathOperation2 case5 = (a, b) -> a + b; + MathOperation2 case6 = (int a, int b) -> a + b; + MathOperation2 case7 = (int a, int b) -> { return a + b; }; + Objects.requireNonNull(null, () -> "message"); + call((x) -> x + x); + new HashSet<Integer>().stream().filter((filter) -> filter > 0); + return y; + } + + static <T> CheckedFunction1<T, T> identitity() { + return t -> t; + } + + public interface CheckedFunction2<T1, T2, R> extends Lambda<R> { + R apply(T1 t1, T2 t2) throws Throwable; + + default CheckedFunction1<T2, R> apply(T1 t1) { + return (T2 t2) -> apply(t1, t2); + } + @Override + default Function1<T1, CheckedFunction1<T2, R>> curried() { + return t1 -> t2 -> apply(t1, t2); + } + default Function1<T1, CheckedFunction1<T2, R>> curried2() { + return (t1) -> (t2) -> apply(t1, t2); + } + default Function1<T1, CheckedFunction1<T2, R>> curried3() { + return (t1) -> t2 -> apply(t1, t2); + } + default Function1<T1, CheckedFunction1<T2, R>> curried4() { + return t1 -> (t2) -> apply(t1, t2); + } + } + + private void call(MathOperation o) { + o.operation(1); + } + + interface MathOperation { + int operation(int a); + } + + interface MathOperation2 { + int operation(int a, int b); + } + + interface Lambda<R> extends Serializable { + Lambda<?> curried(); + } + + public interface Function1<T1, R> extends Lambda<R>, Function<T1, R> { + @Override + default Function1<T1, R> curried() { + return this; + } + } + + public interface CheckedFunction1<T1, R> extends Lambda<R> { + R apply(T1 t1) throws Throwable; + + @Override + default CheckedFunction1<T1, R> curried() { + return this; + } + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenEmptyStatement.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenEmptyStatement.java index b197c15a1..357a328bb 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenEmptyStatement.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenEmptyStatement.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.descendanttoken; +package com.puppycrawl.tools.checkstyle.checks.descendanttoken; public class InputDescendantTokenEmptyStatement { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenIllegalTokens.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenIllegalTokens.java index 00379b20f..b0e45ea85 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenIllegalTokens.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenIllegalTokens.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.descendanttoken; +package com.puppycrawl.tools.checkstyle.checks.descendanttoken; public class InputDescendantTokenIllegalTokens { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenLastTokenType.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenLastTokenType.java new file mode 100644 index 000000000..88a850ad1 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenLastTokenType.java @@ -0,0 +1,6 @@ +package com.puppycrawl.tools.checkstyle.checks.descendanttoken; + +/** + * Created by valeria on 8/19/17. + */ +public class InputDescendantTokenLastTokenType {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenMissingSwitchDefault.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenMissingSwitchDefault.java index 2475f95e5..1f977b1de 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenMissingSwitchDefault.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenMissingSwitchDefault.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.descendanttoken; +package com.puppycrawl.tools.checkstyle.checks.descendanttoken; public class InputDescendantTokenMissingSwitchDefault { public void foo() { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenReturnFromCatch.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenReturnFromCatch.java index e9312a1c0..8cf1f90a9 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenReturnFromCatch.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenReturnFromCatch.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.descendanttoken; +package com.puppycrawl.tools.checkstyle.checks.descendanttoken; public class InputDescendantTokenReturnFromCatch { public void foo() { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenReturnFromFinally.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenReturnFromFinally.java index 566853d55..097f70b8a 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenReturnFromFinally.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenReturnFromFinally.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.descendanttoken; +package com.puppycrawl.tools.checkstyle.checks.descendanttoken; public class InputDescendantTokenReturnFromFinally { public void foo() { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenStringLiteralEquality.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenStringLiteralEquality.java index 2ee908813..db67804b1 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/descendanttoken/InputDescendantTokenStringLiteralEquality.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/descendanttoken/InputDescendantTokenStringLiteralEquality.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.descendanttoken; +package com.puppycrawl.tools.checkstyle.checks.descendanttoken; public class InputDescendantTokenStringLiteralEquality { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/innertypelast/InputInnerTypeLastClassRootClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/innertypelast/InputInnerTypeLastClassRootClass.java new file mode 100644 index 000000000..1c2df5a0e --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/innertypelast/InputInnerTypeLastClassRootClass.java @@ -0,0 +1,18 @@ +package com.puppycrawl.tools.checkstyle.checks.design.innertypelast; + +public enum InputInnerTypeLastClassRootClass { + + ALWAYS(Bits.YES), NEVER(Bits.NO); + + private interface Bits { + public static final int YES = 1; + + public static final int NO = 4; + } + + private final int bits; + + private InputInnerTypeLastClassRootClass(int bits) { + this.bits = bits; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/mutableexception/InputMutableExceptionMultipleInputs.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/mutableexception/InputMutableExceptionMultipleInputs.java new file mode 100644 index 000000000..036f2d121 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/mutableexception/InputMutableExceptionMultipleInputs.java @@ -0,0 +1,15 @@ +package com.puppycrawl.tools.checkstyle.checks.design.mutableexception; + +public class InputMutableExceptionMultipleInputs { + + public class BarError extends Throwable { + private int errorCode; + } + + class CustomMutableException extends java.lang.Exception { + int errorCode; + final int errorCount = 6; + } + + private String variable; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelEnum.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelClassEnum.java index 3043b7b4b..a34ede93c 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelEnum.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelClassEnum.java @@ -1,5 +1,5 @@ package com.puppycrawl.tools.checkstyle.checks.design.onetoplevelclass; -public enum InputOneTopLevelEnum { +public enum InputOneTopLevelClassEnum { VALUE1, VALUE2; } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelEnum2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelClassEnum2.java index 5b7673bfe..5bd8ab293 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelEnum2.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelClassEnum2.java @@ -1,13 +1,13 @@ package com.puppycrawl.tools.checkstyle.checks.design.onetoplevelclass; -enum InputOneTopLevelEnum2inner1 { +enum InputOneTopLevelClassEnum2inner1 { VALUE1, VALUE2; } -public enum InputOneTopLevelEnum2 { +public enum InputOneTopLevelClassEnum2 { VALUE1, VALUE2; } -enum InputOneTopLevelEnum2inner2 { +enum InputOneTopLevelClassEnum2inner2 { VALUE1, VALUE2; } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelInterface.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelClassInterface.java index 4a2fd11f8..cbb70043a 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelInterface.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelClassInterface.java @@ -1,5 +1,5 @@ package com.puppycrawl.tools.checkstyle.checks.design.onetoplevelclass; -public interface InputOneTopLevelInterface { +public interface InputOneTopLevelClassInterface { int foo(); } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelClassInterface2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelClassInterface2.java new file mode 100644 index 000000000..c4215fda4 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelClassInterface2.java @@ -0,0 +1,13 @@ +package com.puppycrawl.tools.checkstyle.checks.design.onetoplevelclass; + +interface InputOneTopLevelClassInterface2inner1 { + int foo(); +} + +public interface InputOneTopLevelClassInterface2 { + int foo(); +} + +interface InputOneTopLevelClassInterface2inner2 { + int foo(); +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelInterface2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelInterface2.java deleted file mode 100644 index ae13b97a4..000000000 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/onetoplevelclass/InputOneTopLevelInterface2.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.puppycrawl.tools.checkstyle.checks.design.onetoplevelclass; - -interface InputOneTopLevelInterface2inner1 { - int foo(); -} - -public interface InputOneTopLevelInterface2 { - int foo(); -} - -interface InputOneTopLevelInterface2inner2 { - int foo(); -} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/throwscount/InputThrowsCountMwthodWithAnnotation.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/throwscount/InputThrowsCountMwthodWithAnnotation.java new file mode 100644 index 000000000..879343553 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/throwscount/InputThrowsCountMwthodWithAnnotation.java @@ -0,0 +1,20 @@ +package com.puppycrawl.tools.checkstyle.checks.design.throwscount; + +import java.awt.AWTException; +import java.io.EOFException; +import java.io.FileNotFoundException; +import java.nio.file.FileAlreadyExistsException; +import java.sql.SQLException; + +public class InputThrowsCountMwthodWithAnnotation extends ParentClass { + @Override + public void method() throws AWTException, SQLException, FileNotFoundException, + EOFException, FileAlreadyExistsException { + super.method(); + } +} + +class ParentClass { + public void method() throws AWTException, SQLException, + FileNotFoundException, EOFException, FileAlreadyExistsException {} +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InputVisibilityModifierImmutableSameTypeName.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InputVisibilityModifierImmutableSameTypeName.java index 23d77b033..43ac8aa83 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InputVisibilityModifierImmutableSameTypeName.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InputVisibilityModifierImmutableSameTypeName.java @@ -1,7 +1,7 @@ package com.puppycrawl.tools.checkstyle.checks.design.visibilitymodifier; import com.puppycrawl.tools.checkstyle.checks.design.visibilitymodifier.InputVisibilityModifierGregorianCalendar; -import com.puppycrawl.tools.checkstyle.checks.design.visibilitymodifier.InetSocketAddress; +import com.puppycrawl.tools.checkstyle.checks.design.visibilitymodifier.inputs.InetSocketAddress; public final class InputVisibilityModifierImmutableSameTypeName { public final java.util.GregorianCalendar calendar = null; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InputVisibilityModifierImmutableStarImport.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InputVisibilityModifierImmutableStarImport.java index 4597b7476..fb7eb38b3 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InputVisibilityModifierImmutableStarImport.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InputVisibilityModifierImmutableStarImport.java @@ -1,7 +1,7 @@ package com.puppycrawl.tools.checkstyle.checks.design.visibilitymodifier; import com.puppycrawl.tools.checkstyle.checks.design.visibilitymodifier.InputVisibilityModifierImmutable; -import com.puppycrawl.tools.checkstyle.checks.design.visibilitymodifier.InetSocketAddress.*; +import com.puppycrawl.tools.checkstyle.checks.design.visibilitymodifier.inputs.InetSocketAddress.*; public final class InputVisibilityModifierImmutableStarImport { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InputVisibilityModifierIsStarImport.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InputVisibilityModifierIsStarImport.java new file mode 100644 index 000000000..56a7d07ea --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InputVisibilityModifierIsStarImport.java @@ -0,0 +1,6 @@ +package com.puppycrawl.tools.checkstyle.checks.design.visibilitymodifier; + +import com.puppycrawl.*; + +public class InputVisibilityModifierIsStarImport { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InetSocketAddress.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/inputs/InetSocketAddress.java index 85def237d..03db31333 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/InetSocketAddress.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier/inputs/InetSocketAddress.java @@ -1,9 +1,9 @@ -package com.puppycrawl.tools.checkstyle.checks.design.visibilitymodifier; +package com.puppycrawl.tools.checkstyle.checks.design.visibilitymodifier.inputs; // ATTENTION: we need name of this class to be without "Input" prefix to as we // need the same name as defined at VisibilityModifierCheck.DEFAULT_IMMUTABLE_TYPES public class InetSocketAddress { - class Arrays { + public class Arrays { } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/finalparameters/InputFinalParameters.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/finalparameters/InputFinalParameters.java index 468d8cf41..4504565d3 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/finalparameters/InputFinalParameters.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/finalparameters/InputFinalParameters.java @@ -2,7 +2,7 @@ // Test case file for checkstyle. // Created: 2003 //////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle.checks.misc.finalparameters; +package com.puppycrawl.tools.checkstyle.checks.finalparameters; import javax.swing.AbstractAction; import javax.swing.Action; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/finalparameters/InputFinalParametersPrimitiveTypes.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/finalparameters/InputFinalParametersPrimitiveTypes.java index b1ae53c7f..2d90353b1 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/finalparameters/InputFinalParametersPrimitiveTypes.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/finalparameters/InputFinalParametersPrimitiveTypes.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.finalparameters; +package com.puppycrawl.tools.checkstyle.checks.finalparameters; public class InputFinalParametersPrimitiveTypes { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/finalparameters/InputFinalParametersReceiver.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/finalparameters/InputFinalParametersReceiver.java index 4b4544733..a903960e8 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/finalparameters/InputFinalParametersReceiver.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/finalparameters/InputFinalParametersReceiver.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.finalparameters; +package com.puppycrawl.tools.checkstyle.checks.finalparameters; public class InputFinalParametersReceiver { public void foo4(InputFinalParametersReceiver this) {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/header/regexpheader/InputRegexpHeaderConsecutiveNewLines.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/header/regexpheader/InputRegexpHeaderConsecutiveNewLines.java new file mode 100644 index 000000000..2bf5afddf --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/header/regexpheader/InputRegexpHeaderConsecutiveNewLines.java @@ -0,0 +1,13 @@ +//////////////////////////////////////////////////////////////////////////////// +// Test case file for checkstyle. +/* */ +// Created: 2017 +//////////////////////////////////////////////////////////////////////////////// +package com.puppycrawl.tools.checkstyle.checks.header.regexpheader; + +/** + * @author Vivek Rao + */ +public class InputRegexpHeaderConsecutiveNewLines +{ +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/header/regexpheader/InputRegexpHeaderNewLines.header b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/header/regexpheader/InputRegexpHeaderNewLines.header new file mode 100644 index 000000000..6bd25a19c --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/header/regexpheader/InputRegexpHeaderNewLines.header @@ -0,0 +1,5 @@ +^/*$ +// .* + +// Created: 2017 +^.*$ diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/avoidstarimport/InputAvoidStarImportDefault.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/avoidstarimport/InputAvoidStarImportDefault.java index 11bc8b758..cbb368110 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/avoidstarimport/InputAvoidStarImportDefault.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/avoidstarimport/InputAvoidStarImportDefault.java @@ -37,9 +37,7 @@ import java.util.BitSet; import com.puppycrawl.tools.checkstyle.Checker; import com.puppycrawl.tools.checkstyle.CheckerTest; -import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; import com.puppycrawl.tools.checkstyle.Definitions; -import com.puppycrawl.tools.checkstyle.checks.imports.unusedimports.Input15Extensions; import com.puppycrawl.tools.checkstyle.ConfigurationLoaderTest; import com.puppycrawl.tools.checkstyle.PackageNamesLoader; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/avoidstaticimport/InputAvoidStaticImportDefault.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/avoidstaticimport/InputAvoidStaticImportDefault.java index 7021edf3c..91754aae4 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/avoidstaticimport/InputAvoidStaticImportDefault.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/avoidstaticimport/InputAvoidStaticImportDefault.java @@ -39,9 +39,7 @@ import java.util.BitSet; import com.puppycrawl.tools.checkstyle.Checker; import com.puppycrawl.tools.checkstyle.CheckerTest; -import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; import com.puppycrawl.tools.checkstyle.Definitions; -import com.puppycrawl.tools.checkstyle.checks.imports.unusedimports.Input15Extensions; import com.puppycrawl.tools.checkstyle.ConfigurationLoaderTest; import com.puppycrawl.tools.checkstyle.PackageNamesLoader; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/illegalimport/InputIllegalImportDefault.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/illegalimport/InputIllegalImportDefault.java index a3657c23f..1d11f842d 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/illegalimport/InputIllegalImportDefault.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/illegalimport/InputIllegalImportDefault.java @@ -37,9 +37,7 @@ import java.util.BitSet; import com.puppycrawl.tools.checkstyle.Checker; import com.puppycrawl.tools.checkstyle.CheckerTest; -import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; import com.puppycrawl.tools.checkstyle.Definitions; -import com.puppycrawl.tools.checkstyle.checks.imports.unusedimports.Input15Extensions; import com.puppycrawl.tools.checkstyle.ConfigurationLoaderTest; import com.puppycrawl.tools.checkstyle.PackageNamesLoader; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importcontrolloader/import-control_MODIFIED_FOR_UT.dtd b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importcontrolloader/InputImportControlLoaderDtd_MODIFIED_FOR_UT.dtd index 4a9233804..4a9233804 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importcontrolloader/import-control_MODIFIED_FOR_UT.dtd +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importcontrolloader/InputImportControlLoaderDtd_MODIFIED_FOR_UT.dtd diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importcontrolloader/InputImportControlLoaderWithNewElement.xml b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importcontrolloader/InputImportControlLoaderWithNewElement.xml index 76b80bfa1..834056549 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importcontrolloader/InputImportControlLoaderWithNewElement.xml +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importcontrolloader/InputImportControlLoaderWithNewElement.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE import-control PUBLIC "-//Puppy Crawl//DTD Import Control 1.UT//EN" - "src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importcontrolloader/import-control_MODIFIED_FOR_UT.dtd"> + "src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importcontrolloader/InputImportControlLoaderDtd_MODIFIED_FOR_UT.dtd"> <import-control pkg="com"> <allow class="some.class"/> diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderNoGapBetweenStaticImports.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderNoGapBetweenStaticImports.java new file mode 100644 index 000000000..2bfdc4fdc --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderNoGapBetweenStaticImports.java @@ -0,0 +1,9 @@ +package com.puppycrawl.tools.checkstyle.checks.imports.importorder; + +import static java.lang.Math.abs; +import static java.lang.Math.cos; // no gap below +import static javax.xml.transform.TransformerFactory.newInstance;//no gap below +import static org.junit.Assert.fail; + +public class InputImportOrderNoGapBetweenStaticImports { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderRepetiton.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderRepetiton.java new file mode 100644 index 000000000..78456928e --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderRepetiton.java @@ -0,0 +1,12 @@ +package com.puppycrawl.tools.checkstyle.checks.imports; + +import java.awt.Button; +import java.awt.Dialog; +import java.awt.event.ActionEvent; +import java.awt.event.ActionEvent; //Repetitive import + +import javax.swing.JComponent; +import javax.swing.JTable; + +public class InputImportOrderRepetiton { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderSortStaticImportsAlphabetically.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderSortStaticImportsAlphabetically.java new file mode 100644 index 000000000..080bc1632 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderSortStaticImportsAlphabetically.java @@ -0,0 +1,9 @@ +package com.puppycrawl.tools.checkstyle.checks.imports.importorder; + +import static org.junit.Assert.fail; +import static javax.xml.transform.TransformerFactory.newInstance; +import static java.lang.Math.cos; +import static java.lang.Math.abs; + +public class InputImportOrderSortStaticImportsAlphabetically { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderStaticGroupSeperated.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderStaticGroupSeperated.java new file mode 100644 index 000000000..dd06f8df5 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderStaticGroupSeperated.java @@ -0,0 +1,13 @@ +package com.puppycrawl.tools.checkstyle.checks.imports.importorder; + +import static java.lang.Math.abs; + +import static java.lang.Math.cos;; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class InputImportOrderStaticGroupSeperated { + void method() { + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderStaticRepetition.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderStaticRepetition.java new file mode 100644 index 000000000..d84874879 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importorder/InputImportOrderStaticRepetition.java @@ -0,0 +1,12 @@ +package com.puppycrawl.tools.checkstyle.checks.imports; + +import static java.lang.Math.*; +import static org.antlr.v4.runtime.CommonToken.*; +import static org.antlr.v4.runtime.CommonToken.*; //Repetitive static import + +import java.util.Set; + +import org.junit.Test; + +public class InputImportOrderStaticRepetition { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputImportBug.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportBug.java index 66a616a02..1396c17f4 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputImportBug.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportBug.java @@ -2,11 +2,11 @@ package com.puppycrawl.tools.checkstyle.checks.imports.redundantimport; import java.net.URL; -public class InputImportBug { +public class InputRedundantImportBug { //same as a class name private static String URL = "This is a String object"; - public InputImportBug() throws Exception { + public InputRedundantImportBug() throws Exception { URL url = new URL("file://this.is.a.url.object"); } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportCheckClearState.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportCheckClearState.java new file mode 100644 index 000000000..16af2527b --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportCheckClearState.java @@ -0,0 +1,9 @@ +package com.puppycrawl.tools.checkstyle.checks.imports.redundantimport; + +import static java.util.Arrays.asList; +import static java.util.Arrays.asList; + +import java.util.List; +import java.util.List; + +public class InputRedundantImportCheckClearState {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportWithChecker.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportWithChecker.java index 12d0c6aec..a917e4850 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportWithChecker.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportWithChecker.java @@ -5,7 +5,7 @@ package com.puppycrawl.tools.checkstyle.checks.imports.redundantimport; import com.puppycrawl.tools.checkstyle.checks.imports.redundantimport.*; -import com.puppycrawl.tools.checkstyle.checks.imports.redundantimport.InputImportBug; +import com.puppycrawl.tools.checkstyle.checks.imports.redundantimport.InputRedundantImportBug; import java.io.*; import java.lang.*; import java.lang.String; @@ -37,9 +37,7 @@ import java.util.BitSet; import com.puppycrawl.tools.checkstyle.Checker; import com.puppycrawl.tools.checkstyle.CheckerTest; -import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; import com.puppycrawl.tools.checkstyle.Definitions; -import com.puppycrawl.tools.checkstyle.checks.imports.unusedimports.Input15Extensions; import com.puppycrawl.tools.checkstyle.ConfigurationLoaderTest; import com.puppycrawl.tools.checkstyle.PackageNamesLoader; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportWithoutWarnings.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportWithoutWarnings.java new file mode 100644 index 000000000..79d339326 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/redundantimport/InputRedundantImportWithoutWarnings.java @@ -0,0 +1,9 @@ +package com.puppycrawl.tools.checkstyle.checks.imports.redundantimport; + +import static java.util.Arrays.asList; + +import java.util.List; + +public class InputRedundantImportWithoutWarnings { + private static final List<String> CONSTANTS = asList("a", "b"); +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImports.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImports.java index 6a24b7d24..069fb2500 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImports.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImports.java @@ -36,9 +36,8 @@ import java.util.BitSet; import com.puppycrawl.tools.checkstyle.Checker; import com.puppycrawl.tools.checkstyle.CheckerTest; -import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; import com.puppycrawl.tools.checkstyle.Definitions; -import com.puppycrawl.tools.checkstyle.checks.imports.unusedimports.Input15Extensions; +import com.puppycrawl.tools.checkstyle.checks.imports.unusedimports.InputUnusedImports15Extensions; import com.puppycrawl.tools.checkstyle.ConfigurationLoaderTest; import com.puppycrawl.tools.checkstyle.PackageNamesLoader; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; @@ -100,7 +99,7 @@ class InputUnusedImports /** * First is a class with a method with arguments {@link Checker#method1(CheckerTest)}. - * Next is a class with typed method {@link BaseFileSetCheckTestSupport#method2(Definitions, Input15Extensions)}. + * Next is a class with typed method {@link BaseFileSetCheckTestSupport#method2(Definitions, InputUnusedImports15Extensions)}. * * @param param1 with a link {@link ConfigurationLoaderTest} * @throws PackageNamesLoader when broken diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/Input15Extensions.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImports15Extensions.java index 7a779606b..45eadb52a 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/Input15Extensions.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImports15Extensions.java @@ -7,7 +7,7 @@ package com.puppycrawl.tools.checkstyle.checks.imports.unusedimports; } @MyAnnotation1(name = "ABC", version = 1) -public class Input15Extensions +public class InputUnusedImports15Extensions { } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportsCheckClearState.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportsCheckClearState.java new file mode 100644 index 000000000..9bf18b724 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportsCheckClearState.java @@ -0,0 +1,7 @@ +package com.puppycrawl.tools.checkstyle.checks.imports.unusedimports; + +import java.util.Arrays; +import java.util.List; +import java.util.Set; + +public class InputUnusedImportsCheckClearState {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportsJavadocQualifiedName.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportsJavadocQualifiedName.java new file mode 100644 index 000000000..f9beada96 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportsJavadocQualifiedName.java @@ -0,0 +1,9 @@ +package com.puppycrawl.tools.checkstyle.checks.imports.unusedimports; + +import java.util.Map; // OK +import java.util.List; // VIOLATION + +/** + * Use {@link Map.Entry} in this javadoc. + */ +public class InputUnusedImportsJavadocQualifiedName {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportWithBlockMethodParameters.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportsWithBlockMethodParameters.java index e176ca131..08c295265 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportWithBlockMethodParameters.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportsWithBlockMethodParameters.java @@ -4,7 +4,7 @@ import java.util.Collection; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; -public class InputUnusedImportWithBlockMethodParameters { +public class InputUnusedImportsWithBlockMethodParameters { /** * @see ExecutorService#invokeAll(Collection, long, TimeUnit) diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportsWithoutWarnings.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportsWithoutWarnings.java new file mode 100644 index 000000000..f14f27bd5 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/unusedimports/InputUnusedImportsWithoutWarnings.java @@ -0,0 +1,8 @@ +package com.puppycrawl.tools.checkstyle.checks.imports.unusedimports; + +import java.util.Arrays; +import java.util.List; + +public class InputUnusedImportsWithoutWarnings { + private static final List<String> CONSTANTS = Arrays.asList("a", "b"); +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryResourcesNotStrict.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryResourcesNotStrict.java new file mode 100644 index 000000000..639ad8381 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryResourcesNotStrict.java @@ -0,0 +1,183 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +import java.io.BufferedWriter; //indent:0 exp:0 +import java.io.IOException; //indent:0 exp:0 +import java.nio.charset.Charset; //indent:0 exp:0 +import java.nio.charset.MalformedInputException; //indent:0 exp:0 +import java.nio.charset.StandardCharsets; //indent:0 exp:0 +import java.nio.file.DirectoryStream; //indent:0 exp:0 +import java.nio.file.Files; //indent:0 exp:0 +import java.nio.file.Path; //indent:0 exp:0 +import java.nio.file.Paths; //indent:0 exp:0 +import java.util.zip.ZipFile; //indent:0 exp:0 + +public final class InputIndentationTryResourcesNotStrict { //indent:0 exp:0 + + private InputIndentationTryResourcesNotStrict() { //indent:4 exp:4 + + } //indent:4 exp:4 + + static void fooMethod(String zipFileName) throws IOException { //indent:4 exp:4 + + Charset charset = StandardCharsets.US_ASCII; //indent:8 exp:8 + Path outputFilePath = Paths.get(zipFileName); //indent:8 exp:8 + + try //indent:8 exp:8 + ( //indent:12 exp:>=8 +final BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset); //indent:0 exp:12 warn + ) { //indent:12 exp:>=8 + ; //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files. //indent:12 exp:12 +newBufferedWriter(outputFilePath, charset); //indent:0 exp:16 warn + ZipFile zf = new ZipFile(zipFileName) //indent:12 exp:12 + ) { //indent:12 exp:>=8 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = Files. //indent:8 exp:8 +newBufferedWriter(outputFilePath, charset); //indent:0 exp:>=12 warn + ZipFile zf = new ZipFile(zipFileName) //indent:12 exp:12 + ) { //indent:12 exp:>=8 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files. //indent:12 exp:12 + newBufferedWriter(outputFilePath, charset); //indent:16 exp:16 + ZipFile zf = new ZipFile(zipFileName) //indent:12 exp:12 + ) { //indent:12 exp:>=8 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile(zipFileName) //indent:12 exp:12 + ) { //indent:12 exp:>=8 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try { //indent:8 exp:8 + try ( //indent:12 exp:12 + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:20 exp:>=16 + writer.flush(); //indent:16 exp:16 + } catch (MalformedInputException e) { //indent:12 exp:12 + //Empty //indent:16 exp:16 + } //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + Integer.parseInt("1"); //indent:12 exp:12 + } //indent:8 exp:8 + try { //indent:8 exp:8 + + } catch (Exception e) { //indent:8 exp:8 + + } //indent:8 exp:8 + try (BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:8 exp:8 + Integer.parseInt("2"); //indent:12 exp:12 + } catch (Exception e) { //indent:8 exp:8 + + } //indent:8 exp:8 + BufferedWriter writ = Files.newBufferedWriter(outputFilePath, charset); //indent:8 exp:8 + try (BufferedWriter writer = writ) { //indent:8 exp:8 + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( BufferedWriter writer = //indent:8 exp:8 + writ) { //indent:19 exp:>=12 + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = //indent:12 exp:12 + writ) { //indent:19 exp:>=16 + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = //indent:12 exp:12 + writ) { //indent:21 exp:>=16 + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:16 exp:16 + ) { //indent:12 exp:>=8 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:17 exp:>=16 + ) { //indent:12 exp:>=8 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:15 exp:>=16 warn + ) { //indent:12 exp:>=8 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:8 exp:8 + writer.close(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:8 exp:8 + writer.close(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:7 exp:8 warn + + + + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:12 exp:12 + writer.close(); //indent:15 exp:12 warn + } //indent:8 exp:8 + try ( //indent:8 exp:8 + + + + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:11 exp:12 warn + writer.close(); //indent:9 exp:12 warn + } //indent:8 exp:8 + try ( //indent:8 exp:8 + + BufferedWriter writer = Files. //indent:11 exp:12 warn + newBufferedWriter(outputFilePath, charset)) { //indent:11 exp:16 warn + writer.close(); //indent:13 exp:12 warn + } //indent:8 exp:8 + try (BufferedWriter writer = writ //indent:7 exp:8 warn + ) { //indent:7 exp:>=8,12 warn + } catch (MalformedInputException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer1 = writ; //indent:8 exp:8 + BufferedWriter writer2 = writ; //indent:12 exp:>=12 + BufferedWriter writer3 = writ; //indent:13 exp:>=12 + BufferedWriter writer4 = writ; //indent:14 exp:>=12 + BufferedWriter writer5 = writ) { //indent:15 exp:>=12 + } catch (MalformedInputException e) { //indent:8 exp:8 + ; //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = Files //indent:8 exp:8 + .newBufferedWriter(outputFilePath, charset)) { //indent:8 exp:>=12 warn + ; //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = Files //indent:8 exp:8 + .newBufferedWriter(outputFilePath, charset)) { //indent:13 exp:>=12 + ; //indent:12 exp:12 + } //indent:8 exp:8 + try (DirectoryStream<Path> ds = Files.newDirectoryStream(outputFilePath, //indent:8 exp:8 + new DirectoryStream.Filter<Path>() { //indent:11 exp:>=12 warn + @Override //indent:16 exp:16 + public boolean accept(Path path) { //indent:16 exp:16 + return path.toString().contains(""); //indent:20 exp:20 + } //indent:16 exp:16 + })) //indent:12 exp:12 + { //indent:8 exp:8 + for (Path p : ds) //indent:12 exp:12 + ; //indent:16 exp:16 + } //indent:8 exp:8 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryWithResourcesStrict.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryWithResourcesStrict.java new file mode 100644 index 000000000..4297d2c88 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryWithResourcesStrict.java @@ -0,0 +1,184 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +import java.io.BufferedWriter; //indent:0 exp:0 +import java.io.IOException; //indent:0 exp:0 +import java.nio.charset.Charset; //indent:0 exp:0 +import java.nio.charset.MalformedInputException; //indent:0 exp:0 +import java.nio.charset.StandardCharsets; //indent:0 exp:0 +import java.nio.file.DirectoryStream; //indent:0 exp:0 +import java.nio.file.Files; //indent:0 exp:0 +import java.nio.file.Path; //indent:0 exp:0 +import java.nio.file.Paths; //indent:0 exp:0 +import java.util.zip.ZipFile; //indent:0 exp:0 + +public final class InputIndentationTryWithResourcesStrict { //indent:0 exp:0 + + private InputIndentationTryWithResourcesStrict() { //indent:4 exp:4 + + } //indent:4 exp:4 + + static void fooMethod(String zipFileName) throws IOException { //indent:4 exp:4 + + Charset charset = StandardCharsets.US_ASCII; //indent:8 exp:8 + Path outputFilePath = Paths.get(zipFileName); //indent:8 exp:8 + + try ( //indent:8 exp:8 +final BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset); //indent:0 exp:12 warn + ZipFile zf = new ZipFile(zipFileName) //indent:12 exp:12 + ) { //indent:13 exp:8,12 warn + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files. //indent:12 exp:12 +newBufferedWriter(outputFilePath, charset); //indent:0 exp:16 warn + ZipFile zf = new ZipFile(zipFileName) //indent:12 exp:12 + ) { //indent:8 exp:8,12 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = Files. //indent:8 exp:8 +newBufferedWriter(outputFilePath, charset); //indent:0 exp:12 warn + ZipFile zf = new ZipFile(zipFileName) //indent:12 exp:12 + ) { //indent:12 exp:8,12 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files. //indent:12 exp:12 + newBufferedWriter(outputFilePath, charset); //indent:16 exp:16 + ZipFile zf = new ZipFile(zipFileName) //indent:12 exp:12 + ) { //indent:12 exp:8,12 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile(zipFileName) //indent:12 exp:12 + ) { //indent:12 exp:8,12 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try { //indent:8 exp:8 + try ( //indent:12 exp:12 + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:20 exp:16 warn + writer.flush(); //indent:16 exp:16 + } catch (MalformedInputException e) { //indent:12 exp:8,12 + //Empty //indent:16 exp:16 + } //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + Integer.parseInt("1"); //indent:12 exp:12 + } //indent:8 exp:8 + try { //indent:8 exp:8 + + } catch (Exception e) { //indent:8 exp:8 + + } //indent:8 exp:8 + try (BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:8 exp:8 + Integer.parseInt("2"); //indent:12 exp:12 + } catch (Exception e) { //indent:8 exp:8 + + } //indent:8 exp:8 + BufferedWriter writ = Files.newBufferedWriter(outputFilePath, charset); //indent:8 exp:8 + try (BufferedWriter writer = writ) { //indent:8 exp:8 + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( BufferedWriter writer = //indent:8 exp:8 + writ) { //indent:19 exp:12 warn + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = //indent:12 exp:12 + writ) { //indent:19 exp:16 warn + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = //indent:12 exp:12 + writ) { //indent:21 exp:16 warn + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:16 exp:16 + ) { //indent:12 exp:8,12 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:17 exp:16 warn + ) { //indent:12 exp:8,12 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:15 exp:16 warn + ) { //indent:12 exp:8,12 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:8 exp:8 + writer.close(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:8 exp:8 + writer.close(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:7 exp:8 warn + + + + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:12 exp:12 + writer.close(); //indent:15 exp:12 warn + } //indent:8 exp:8 + try ( //indent:8 exp:8 + + + + BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset)) { //indent:11 exp:12 warn + writer.close(); //indent:9 exp:12 warn + } //indent:8 exp:8 + try ( //indent:8 exp:8 + + BufferedWriter writer = Files. //indent:11 exp:12 warn + newBufferedWriter(outputFilePath, charset)) { //indent:11 exp:16 warn + writer.close(); //indent:13 exp:12 warn + } //indent:8 exp:8 + try (BufferedWriter writer = writ //indent:7 exp:8 warn + ) { //indent:7 exp:8,12 warn + } catch (MalformedInputException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = writ //indent:9 exp:8 warn + ) { //indent:12 exp:8,12 + } catch (MalformedInputException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = Files //indent:8 exp:8 + .newBufferedWriter(outputFilePath, charset)//indent:13 exp:12 warn + ) { //indent:12 exp:8,12 + } catch (MalformedInputException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( BufferedWriter writer = Files //indent:8 exp:8 + .newBufferedWriter(outputFilePath, charset)//indent:11 exp:12 warn + ) { //indent:12 exp:8,12 + } catch (MalformedInputException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try (DirectoryStream<Path> ds = Files.newDirectoryStream(outputFilePath, //indent:8 exp:8 + new DirectoryStream.Filter<Path>() { //indent:12 exp:12 + @Override //indent:16 exp:16 + public boolean accept(Path path) { //indent:16 exp:16 + return path.toString().contains(""); //indent:20 exp:20 + } //indent:16 exp:16 + })) //indent:12 exp:12 + { //indent:8 exp:8 + for (Path p : ds) //indent:12 exp:12 + ; //indent:16 exp:16 + } //indent:8 exp:8 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidTryResourcesIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidTryResourcesIndent.java index 56f02ead1..e2792147b 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidTryResourcesIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidTryResourcesIndent.java @@ -25,8 +25,7 @@ class InputIndentationValidTryResourcesIndent //indent:0 exp:0 // Taken from JDK7 java.lang.Package src code. //indent:4 exp:4 private static Manifest loadManifest(String fn) { //indent:4 exp:4 try (FileInputStream fis = new FileInputStream(fn); //indent:8 exp:8 - // This should be an error //indent:4 exp:4 - JarInputStream jis = new JarInputStream(fis, false)) //indent:4 exp:4 + JarInputStream jis = new JarInputStream(fis, false)) //indent:12 exp:12 { //indent:8 exp:8 return jis.getManifest(); //indent:12 exp:12 } catch (IOException e) //indent:8 exp:8 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocJavadocTagsWithoutArgs.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocJavadocTagsWithoutArgs.java new file mode 100644 index 000000000..da491d075 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocJavadocTagsWithoutArgs.java @@ -0,0 +1,70 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc.abstractjavadoc; + +import java.io.Serializable; + +/**@author*/ +public class InputAbstractJavadocJavadocTagsWithoutArgs implements Serializable{ + /**@serial*/ + private static final long serialVersionUID = 7556448691029650757L; + + /**@see*/ + private static int field2; + + /**@since*/ + private static String field3; + + /**@version*/ + private static Object field4; + + /**serialField*/ + private static Object field5; + + /**@exception*/ + public static void method1() { + + } + + /**@throws*/ + public static void method2() { + + } + + /**@return*/ + public static int method3() { + return -1; + } + + /**@param*/ + public static void method4(int a) { + + } + + /**@customTag*/ + public static void method5(int a) { + + } + + /**@deprecated*/ + public static void method6(int a) { + + } + + /**@serialData*/ + private void readObject(java.io.ObjectInputStream inputStream) { + + } + + /** + * {@link} + */ + public void method7() { + + } + + /** + * {@linkplain } + */ + public void method8() { + + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocNoWsBeforeDescriptionInJavadocTags.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocNoWsBeforeDescriptionInJavadocTags.java new file mode 100644 index 000000000..fabc0e483 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocNoWsBeforeDescriptionInJavadocTags.java @@ -0,0 +1,97 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc.abstractjavadoc; + +import java.io.ObjectStreamField; +import java.io.Serializable; + +/** + * @author author-name <link rel="author license" href="/about"> + */ +public class InputAbstractJavadocNoWsBeforeDescriptionInJavadocTags implements Serializable{ + + /** + * Parse Error from ANTLR. + * @serial include description + * @see <a + * href="https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#serial"> + * oracle docs</a> Syntax: <b>@serial field-description | include | exclude</b> + */ + private static final long serialVersionUID = 8669426759693842025L; + + /** + * Parse Error from ANTLR. + * @serialField Fieldname-fieldtype-fielddescription + */ + private static ObjectStreamField objectStreamField1; + + /** + * Parse Error from ANTLR. + * @serialField Fieldname fieldtype-fielddescription + */ + private static ObjectStreamField objectStreamField2; + + /** + * @serialField Fieldname -fieldtype -fielddescription <!-- No + * error --> + */ + private static ObjectStreamField objectStreamField3; + + /** + * Parse Error from ANTLR. + * @exception RuntimeException-description + */ + private static void method1() { + + } + + /** + * Parse Error from ANTLR. + * @throws RuntimeException-description + */ + private static void method2() { + + } + + /** + * Parse Error from ANTLR. + * + * @param a-description + */ + private static void method3(int a) { + + } + + /** + * @see #objectStreamField1-description + */ + private static void method4() { + + } + + /** + * @customTag<description> + */ + private static void method8() { + + } + + /** + * {@link #objectStreamField2-description} + */ + private static void method5() { + + } + + /** + * {@linkplain #objectStreamField3-description} + */ + private static void method6() { + + } + + /** + * {@customlink<description>} + */ + private static void method7() { + + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocNonTightHtmlTags.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocNonTightHtmlTags.java new file mode 100644 index 000000000..a2e2ec563 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocNonTightHtmlTags.java @@ -0,0 +1,129 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc.abstractjavadoc; + +/** + * <body> + * <p> This class is only meant for testing. </p> + * <p> In html, closing all tags is not necessary. + * <li> neither is opening every tag <p> </li> + * </body> + * + * @see "https://www.w3.org/TR/html51/syntax.html#optional-start-and-end-tags" + */ +public class InputAbstractJavadocNonTightHtmlTags { + /** <p> <p> paraception </p> </p> */ + private int field1; + + /**<li> paraTags should be opened</p> list isn't nested in parse tree </li>*/ + private int field2; + + /** + * <p> this paragraph is closed and would be nested in javadoc tree </p> + * <li> this list has an <p> unclosed para, but still the list would get nested </li> + */ + private int field3; + + /** + * <li> Complete <p> nesting </p> </li> + * <tr> Zero </p> nesting despite `tr` is closed </tr> + */ + private int field4; + + /** + * <p> <a href="www.something.com">something</a> paragraph with `htmlTag` </p> + * <p> <a href="www.something.com"/> Nested paragraph with `singletonTag` </p> + * <li> Outer tag <li> Inner tag nested </li> not nested </li> + */ + private int field5; + + /** + * <th> !isNonTight </th> + * <th> th with <base/> singletonElement </th> + * <body> body with <br/> singletonElement </body> + * <colgroup><col><col><col></colgroup> + * <dd> dd with <hr> singletonElement </dd> + * <dt> dt with <img src="~/singletonElement.jpg" alt="" width="100" height="150"/> + * singletonElement </dt> + * <head> head with <img src="~/singletonElement.jpg" alt="" width="100" height="150"> + * singletonElement </head> + */ + private int field6; + + /** + * <body> body <p> paragraph <li> list </li> </p> </body> + * + * @return <li> <li> outer list isn't nested in parse tree </li> </li> + */ + int getField1() {return field1;} + + /***/ + int getField2() {return field2;} //method with empty javadoc + + /** + * <tr> <li> list is going to be nested in the parse tree </li> </tr> + * + * @param field1 {@code <p> paraTag will not be recognized} in javadoc tree </p> + */ + void setField1(int field1) {this.field1 = field1;} + + /** + * <p>This is a setter method. + * And paraTag shall be nested in parse tree </p> + * @param field2 <p> settter + */ + void setField2(int field2) {this.field2 = field2;} + + /** + * <p> paragraph with a <br>singletonElement. <hr> And it contains another one. </p> + * <li> List with singletonElement + * <param name=mov value="~/imitation game.mp4"> <param name=allowfullscreen value=true> </li> + * @return <tr> tr with <base href="www.something.com"> singletonElement </tr> + * <tr> nonTight </th> + */ + private int getField3() {return field3;} + + /** + * @param field3 <td> td with singletonElement <br/> </td> + */ + private void setField3(int field3) { this.field3 = field3;} + + /** + * <html> <bR> <Br> <BR> <Br/> <BR/> <bR/> </html> + * <option> <INPut/> </option> + * @return <tbody> <input/> <br> </tbody> + */ + private int getField4() {return field4;} + + /** + * <thead> <br> </thead> + * <tfoot> <AREA ALT="alt" COORDS="100,0,200,50" HREF="/href/"> </tfoot> + * <p> </p> + * @param field4 value to which {@link #field4} is to be set to + */ + private void setField4(int field4) {this.field4 = field4;} + + /** + * <li> </li> + * <TR> </tr> + * <Td> </td> + * <tH> </th> + * <body> </body> + * <colGROUP> </COLgroup> + * <DD> </dd> + * <dt> </dt> + * <Head> </head> + * <HTML> </HTML> + * <option> </option> + * <tBody> </TbODY> + * <tHead> </ThEAD> + * <tFoot> </TfOOT> + * @param field5 value to which {@link #field5} is to be set to + */ + private void setField5(int field5) {this.field5 = field5;} + + /** + * <p> <li> <TR> <Td> <tH> <body> <colGROUP> <DD> <dt> <Head> <HTML> <option> <tBody> <tHead> + * <tFoot> + * @param field6 </p> value to which {@link #field6} is to be set to + */ + private void setField6(int field6) {this.field6 = field6;} +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocNonTightHtmlTags2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocNonTightHtmlTags2.java new file mode 100644 index 000000000..1cf6024f4 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocNonTightHtmlTags2.java @@ -0,0 +1,90 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc.abstractjavadoc; + +/** + * <body> + * <p> This class is only meant for testing. </p> + * <p> In html, closing all tags is not necessary. + * <li> neither is opening every tag. <p>Only the first non-tight tag is logged</li> + * </body> + * + * @see "https://www.w3.org/TR/html51/syntax.html#optional-start-and-end-tags" + */ +public class InputAbstractJavadocNonTightHtmlTags2 { + /** <p> <p> paraception </p> </p> */ + private int field1; + + /**<li> paraTags should be opened</p> list isn't nested in parse tree </li>*/ + private int field2; + + /** + * <p> this paragraph is closed and would be nested in javadoc tree </p> + * <li> this list has an <p> unclosed para, but still the list would get nested </li> + */ + private int field3; + + /** + * <li> Complete <p> nesting </p> </li> + * <tr> Zero </p> nesting despite `tr` is closed </tr> + */ + private int field4; + + /** + * <p> <a href="www.something.com">something</a> paragraph with `htmlTag` </p> + * <p> <a href="www.something.com"/> Nested paragraph with `singletonTag` </p> + * <li> Outer tag <li> Inner tag nested </li> not nested </li> + */ + private int field5; + + /** + * <body> body <p> paragraph <li> list </li> </p> </body> + * + * @return <li> <li> outer list isn't nested in parse tree </li> </li> + */ + int getField1() {return field1;} + + /***/ + int getField2() {return field2;} //method with empty javadoc + + /** + * <p>This is a setter method. + * And paraTag shall be nested in parse tree </p> + * @param field2 <p> settter + */ + void setField2(int field2) {this.field2 = field2;} + + /** + * <p> paragraph with a <br>singletonElement. <hr> And it contains another one. </p> + * <li> List with singletonElement + * <param name=mov value="~/imitation game.mp4"> <param name=allowfullscreen value=true> </li> + * @return <tr> tr with <base href="www.something.com"> singletonElement </tr> + * <tr> nonTight </th> + */ + private int getField3() {return field3;} + + /** + * @param field3 <td> td with singletonElement <br/> </td> + */ + private void setField3(int field3) { this.field3 = field3;} + + /** + * <html> <bR> <Br> <BR> <Br/> <BR/> <bR/> </html> + * <option> <INPut/> </option> + * @return <tbody> <input/> <br> </tbody> + */ + private int getField4() {return field4;} + + /** + * <thead> <br> </thead> + * <tfoot> <AREA ALT="alt" COORDS="100,0,200,50" HREF="/href/"> </tfoot> + * <p> </p> + * @param field4 value to which {@link #field4} is to be set to + */ + private void setField4(int field4) {this.field4 = field4;} + + /** + * <p> <li> <TR> <Td> <tH> <body> <colGROUP> <DD> <dt> <Head> <HTML> <option> <tBody> <tHead> + * <tFoot> + * @param field5 </p> value to which {@link #field5} is to be set to + */ + private void setField5(int field5) {this.field5 = field5;} +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocWrongSingletonTagInJavadoc.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocWrongSingletonTagInJavadoc.java new file mode 100644 index 000000000..970c800e1 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/abstractjavadoc/InputAbstractJavadocWrongSingletonTagInJavadoc.java @@ -0,0 +1,28 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc.abstractjavadoc; + +public class InputAbstractJavadocWrongSingletonTagInJavadoc { + /** + * </embed> + */ + private int field1; + + /** + * </keygen> + */ + private int field2; + + /** + * </SOURCE> + */ + private int field3; + + /** + * </TRACK> + */ + private int field4; + + /** + * </WBR> + */ + private int field5; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/atclauseorder/InputAtClauseOrderCorrect.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/atclauseorder/InputAtclauseOrderCorrect.java index 3504c266d..3504c266d 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/atclauseorder/InputAtClauseOrderCorrect.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/atclauseorder/InputAtclauseOrderCorrect.java diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/atclauseorder/InputAtClauseOrderIncorrect.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/atclauseorder/InputAtclauseOrderIncorrect.java index 33b87b51a..33b87b51a 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/atclauseorder/InputAtClauseOrderIncorrect.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/atclauseorder/InputAtclauseOrderIncorrect.java diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocpackage/noparentfile/package-info.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocpackage/noparentfile/package-info.java new file mode 100644 index 000000000..f7832c2f3 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocpackage/noparentfile/package-info.java @@ -0,0 +1 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc.javadocpackage.noparentfile; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavaDocParagraphCorrect.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphCorrect.java index c4dafe3f5..e47219f4e 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavaDocParagraphCorrect.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphCorrect.java @@ -6,7 +6,7 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc.javadocparagraph; * <p>Some Javadoc. * */ -class InputCorrectJavaDocParagraphCorrect { +class InputJavadocParagraphCorrect { /** * Some Javadoc. @@ -53,7 +53,7 @@ class InputCorrectJavaDocParagraphCorrect { * <p>Some Javadoc. * */ - class InnerInputCorrectJavaDocParagraphCheck { + class InnerInputJavadocParagraphCorrect { /** * Some Javadoc. @@ -77,7 +77,7 @@ class InputCorrectJavaDocParagraphCorrect { boolean emulated() {return false;} } - InnerInputCorrectJavaDocParagraphCheck anon = new InnerInputCorrectJavaDocParagraphCheck() { + InnerInputJavadocParagraphCorrect anon = new InnerInputJavadocParagraphCorrect() { /** * Some Javadoc. diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavaDocParagraphIncorrect.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect.java index 8ef60a4c1..42520ba49 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavaDocParagraphIncorrect.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect.java @@ -8,7 +8,7 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc.javadocparagraph; * /^ WARN/ Some Javadoc.<p> //WARN * */ -class InputJavaDocParagraphIncorrect { +class InputJavadocParagraphIncorrect { /** * Some Javadoc.<P> //WARN @@ -33,7 +33,7 @@ class InputJavaDocParagraphIncorrect { * <p> //WARN * <p><p> //WARN * <p>/^WARN/ Some Javadoc.<p>*/ //WARN - class InnerInputCorrectJavaDocParagraphCheck { + class InnerInputJavadocParagraphIncorrect { /** * Some Javadoc./WARN/<p> //WARN @@ -55,7 +55,7 @@ class InputJavaDocParagraphIncorrect { boolean emulated() {return false;} } - InnerInputCorrectJavaDocParagraphCheck anon = new InnerInputCorrectJavaDocParagraphCheck() { + InnerInputJavadocParagraphIncorrect anon = new InnerInputJavadocParagraphIncorrect() { /** * <p>Some Javadoc. //WARN diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadoctagcontinuationindentation/InputJavadocTagContinuationIndentation.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadoctagcontinuationindentation/InputJavadocTagContinuationIndentation.java index a43c20756..27d5e6f37 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadoctagcontinuationindentation/InputJavadocTagContinuationIndentation.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadoctagcontinuationindentation/InputJavadocTagContinuationIndentation.java @@ -324,7 +324,7 @@ enum Foo1 {} * L. * * @author max - * @see {@link com.puppycrawl.tools.checkstyle.AllChecksPresentOnAvailableChecksPageTest + * @customTag {@link com.puppycrawl.tools.checkstyle.AllChecksPresentOnAvailableChecksPageTest * some description} // no warning, as this is just inline tag description */ interface FooIn1 {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/nonemptyatclausedescription/InputNonEmptyAtclauseDescription.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/nonemptyatclausedescription/InputNonEmptyAtclauseDescription.java index ee7880239..bf3346d00 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/nonemptyatclausedescription/InputNonEmptyAtclauseDescription.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/nonemptyatclausedescription/InputNonEmptyAtclauseDescription.java @@ -75,7 +75,7 @@ class InputNonEmptyAtclauseDescription * @param a * @param b * @param c - * @return + * @deprecated * @throws Exception * @deprecated */ @@ -89,7 +89,7 @@ class InputNonEmptyAtclauseDescription * @param a * @param b * @param c - * @return + * @deprecated * @throws Exception */ public int foo4(String a, int b, double c) throws Exception diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputSummaryJavadocCorrect.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputSummaryJavadocCorrect.java index f4e6f9f30..c855ae607 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputSummaryJavadocCorrect.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputSummaryJavadocCorrect.java @@ -50,6 +50,36 @@ class InputSummaryJavadocCorrect { void foo10() {} /** + * {@inheritDoc}mm + */ + void foo9a() {} + + /** + * {@inheritDoc}mm. + */ + void foo11() {} + + /** + * {@inheritDoc} M m m m + */ + void foo12() {} + + /** + * {@inheritDoc} M m m m. + */ + void foo13() {} + + /** + * mm. {@inheritDoc} + */ + void foo14() {} + + /** + * M m m m. {@inheritDoc} + */ + void foo15() {} + + /** * This is summary java doc. * <a href="mailto:vlad@htmlbook.ru"/> */ diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputSummaryJavadocIncorrect.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputSummaryJavadocIncorrect.java index 4f5175241..84f8b9adf 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputSummaryJavadocIncorrect.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputSummaryJavadocIncorrect.java @@ -119,11 +119,6 @@ class InputSummaryJavadocIncorrect { void foo7() {} /** - * {@inheritDoc}mm - */ - void foo9() {} - - /** * {@link #setBounds(int,int,int,int)} */ void foo8() {} @@ -133,4 +128,9 @@ class InputSummaryJavadocIncorrect { */ void foo10() {} }; + + /** + * M m m m {@inheritDoc} + */ + void foo7() {} } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputPeriodAtEnd.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputSummaryJavadocPeriodAtEnd.java index 2e86f946f..ca4cf505a 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputPeriodAtEnd.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputSummaryJavadocPeriodAtEnd.java @@ -1,7 +1,7 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc.summaryjavadoc; -public class InputPeriodAtEnd { +public class InputSummaryJavadocPeriodAtEnd { /** * JAXB 1.0 only default validation event handler */ @@ -47,4 +47,14 @@ public class InputPeriodAtEnd { public void foo5(){ } + + /** + * <p>Sentence without period</p> + * + * <p> this is a <br> + * paragraph.</p> + */ + public void foo6() { + + } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesAllIgnored.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesAllIgnored.java index 3221c311f..a94052450 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesAllIgnored.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesAllIgnored.java @@ -1,9 +1,9 @@ package com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.aa.AAClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.ab.ABClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.b.BClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.c.CClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.a.aa.AAClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.a.ab.ABClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.b.BClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.c.CClass; public class InputClassDataAbstractionCouplingExcludedPackagesAllIgnored { // total: ok public AAClass aa = new AAClass(); // ok diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesCommonPackage.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesCommonPackage.java index cfed1a652..9f05852d9 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesCommonPackage.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesCommonPackage.java @@ -1,9 +1,9 @@ package com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.aa.AAClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.ab.ABClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.b.BClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.c.CClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.a.aa.AAClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.a.ab.ABClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.b.BClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.c.CClass; public class InputClassDataAbstractionCouplingExcludedPackagesCommonPackage { // total: ok public AAClass aa = new AAClass(); // ok diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesDirectPackages.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesDirectPackages.java index 4fc3ca739..35f20a321 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesDirectPackages.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/InputClassDataAbstractionCouplingExcludedPackagesDirectPackages.java @@ -1,9 +1,9 @@ package com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.aa.AAClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.ab.ABClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.b.BClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.c.CClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.a.aa.AAClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.a.ab.ABClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.b.BClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.c.CClass; public class InputClassDataAbstractionCouplingExcludedPackagesDirectPackages { // total: 2 violations public AAClass aa = new AAClass(); // violation diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/a/aa/AAClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/a/aa/AAClass.java new file mode 100644 index 000000000..1398980c8 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/a/aa/AAClass.java @@ -0,0 +1,4 @@ +package com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.a.aa; + +public class AAClass { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/a/ab/ABClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/a/ab/ABClass.java new file mode 100644 index 000000000..252f5d298 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/a/ab/ABClass.java @@ -0,0 +1,4 @@ +package com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.a.ab; + +public class ABClass { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/b/BClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/b/BClass.java new file mode 100644 index 000000000..a9a003696 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/b/BClass.java @@ -0,0 +1,4 @@ +package com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.b; + +public class BClass { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/c/CClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/c/CClass.java new file mode 100644 index 000000000..f08948b15 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classdataabstractioncoupling/inputs/c/CClass.java @@ -0,0 +1,4 @@ +package com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.inputs.c; + +public class CClass { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexity.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexity.java index ff435d5fa..ff5a33894 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexity.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexity.java @@ -41,3 +41,9 @@ class InputThrows { new java.lang.ref.ReferenceQueue<Integer>(); } } + +class InputMultiDimensionalArray { + public Object[][] get() { + return new Object[][]{}; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesAllIgnored.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesAllIgnored.java index 40f3a385f..b3ace98da 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesAllIgnored.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesAllIgnored.java @@ -1,9 +1,9 @@ package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.aa.AAClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.ab.ABClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.b.BClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.c.CClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.a.aa.AAClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.a.ab.ABClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.b.BClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.c.CClass; public class InputClassFanOutComplexityExcludedPackagesAllIgnored { // total: ok public AAClass aa; // ok diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesCommonPackage.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesCommonPackage.java index 10b1f6785..aba6e83c8 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesCommonPackage.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesCommonPackage.java @@ -1,9 +1,9 @@ package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.aa.AAClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.ab.ABClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.b.BClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.c.CClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.a.aa.AAClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.a.ab.ABClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.b.BClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.c.CClass; public class InputClassFanOutComplexityExcludedPackagesCommonPackage { // total: 2 violations public AAClass aa; // violation diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesDirectPackages.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesDirectPackages.java index 1d6733866..91f71cad7 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesDirectPackages.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityExcludedPackagesDirectPackages.java @@ -1,9 +1,9 @@ package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.aa.AAClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.ab.ABClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.b.BClass; -import com.puppycrawl.tools.checkstyle.checks.metrics.inputs.c.CClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.a.aa.AAClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.a.ab.ABClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.b.BClass; +import com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.c.CClass; public class InputClassFanOutComplexityExcludedPackagesDirectPackages { // total: 2 violations public AAClass aa; // violation diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityMultiDimensionalArray.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityMultiDimensionalArray.java new file mode 100644 index 000000000..5c8c026fb --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityMultiDimensionalArray.java @@ -0,0 +1,7 @@ +package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity; + +public class InputClassFanOutComplexityMultiDimensionalArray { + public Object[][] get() { + return new Object[][]{}; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/a/aa/AAClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/a/aa/AAClass.java new file mode 100644 index 000000000..a02f51728 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/a/aa/AAClass.java @@ -0,0 +1,4 @@ +package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.a.aa; + +public class AAClass { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/a/ab/ABClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/a/ab/ABClass.java new file mode 100644 index 000000000..335d82b6a --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/a/ab/ABClass.java @@ -0,0 +1,4 @@ +package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.a.ab; + +public class ABClass { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/b/BClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/b/BClass.java new file mode 100644 index 000000000..cd7bfa94a --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/b/BClass.java @@ -0,0 +1,4 @@ +package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.b; + +public class BClass { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/c/CClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/c/CClass.java new file mode 100644 index 000000000..f49c95852 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/inputs/c/CClass.java @@ -0,0 +1,4 @@ +package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity.inputs.c; + +public class CClass { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/a/aa/AAClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/a/aa/AAClass.java deleted file mode 100644 index 7e07ece8b..000000000 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/a/aa/AAClass.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.aa; - -public class AAClass { -} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/a/ab/ABClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/a/ab/ABClass.java deleted file mode 100644 index f965291fb..000000000 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/a/ab/ABClass.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.puppycrawl.tools.checkstyle.checks.metrics.inputs.a.ab; - -public class ABClass { -} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/b/BClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/b/BClass.java deleted file mode 100644 index 4700d37a3..000000000 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/b/BClass.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.puppycrawl.tools.checkstyle.checks.metrics.inputs.b; - -public class BClass { -} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/c/CClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/c/CClass.java deleted file mode 100644 index 6f24ceddb..000000000 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/inputs/c/CClass.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.puppycrawl.tools.checkstyle.checks.metrics.inputs.c; - -public class CClass { -} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/fileset/InputFileSetIllegalTokens.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/fileset/InputFileSetIllegalTokens.java deleted file mode 100644 index 8bb5af906..000000000 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/fileset/InputFileSetIllegalTokens.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.fileset; - -public class InputFileSetIllegalTokens -{ - public void methodWithPreviouslyIllegalTokens() - { - int i = 0; - switch (i) - { - default: - i--; - i++; - break; - } - } - - public native void nativeMethod(); -} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/modifier/redundantmodifier/InputRedundantModifierAnnotationOnEnumConstructor.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/modifier/redundantmodifier/InputRedundantModifierAnnotationOnEnumConstructor.java new file mode 100644 index 000000000..162a81dcd --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/modifier/redundantmodifier/InputRedundantModifierAnnotationOnEnumConstructor.java @@ -0,0 +1,16 @@ +package com.puppycrawl.tools.checkstyle.checks.modifier.redundantmodifier; + +public enum InputRedundantModifierAnnotationOnEnumConstructor { + ; + + @SuppressWarnings("checkstyle:name") + InputRedundantModifierAnnotationOnEnumConstructor() { + } +} +enum InputRedundantModifierAnnotationOnEnumConstructor2 { + ; + + @SuppressWarnings("checkstyle:name") + private InputRedundantModifierAnnotationOnEnumConstructor2() { + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbrevationaswordinname/InputAbbreviationAsWordInNameAbstractMultisetSetCount.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbreviationaswordinname/InputAbbreviationAsWordInNameAbstractMultisetSetCount.java index d7a1756a4..d888a7c70 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbrevationaswordinname/InputAbbreviationAsWordInNameAbstractMultisetSetCount.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbreviationaswordinname/InputAbbreviationAsWordInNameAbstractMultisetSetCount.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.naming.abbrevationaswordinname; +package com.puppycrawl.tools.checkstyle.checks.naming.abbreviationaswordinname; public abstract class InputAbbreviationAsWordInNameAbstractMultisetSetCount<E> { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbrevationaswordinname/InputAbbreviationAsWordInNameOverridableMethod.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbreviationaswordinname/InputAbbreviationAsWordInNameOverridableMethod.java index e769e0421..f80ea9710 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbrevationaswordinname/InputAbbreviationAsWordInNameOverridableMethod.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbreviationaswordinname/InputAbbreviationAsWordInNameOverridableMethod.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.naming.abbrevationaswordinname; +package com.puppycrawl.tools.checkstyle.checks.naming.abbreviationaswordinname; import org.junit.Before; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbrevationaswordinname/InputAbbreviationAsWordInNameReceiver.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbreviationaswordinname/InputAbbreviationAsWordInNameReceiver.java index 756fb4f43..28c9ddb82 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbrevationaswordinname/InputAbbreviationAsWordInNameReceiver.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbreviationaswordinname/InputAbbreviationAsWordInNameReceiver.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.naming.abbrevationaswordinname; +package com.puppycrawl.tools.checkstyle.checks.naming.abbreviationaswordinname; public class InputAbbreviationAsWordInNameReceiver { public void foo4(InputAbbreviationAsWordInNameReceiver this) {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbrevationaswordinname/InputAbbreviationAsWordInNameType.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbreviationaswordinname/InputAbbreviationAsWordInNameType.java index fa5a3ab8f..8519b2967 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbrevationaswordinname/InputAbbreviationAsWordInNameType.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/abbreviationaswordinname/InputAbbreviationAsWordInNameType.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.naming.abbrevationaswordinname; +package com.puppycrawl.tools.checkstyle.checks.naming.abbreviationaswordinname; abstract class IIIInputAbstractClassName { } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/parametername/InputAccessModifier.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/parametername/InputParameterNameAccessModifier.java index 0fa58b8d2..242c34025 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/parametername/InputAccessModifier.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/parametername/InputParameterNameAccessModifier.java @@ -1,8 +1,8 @@ package com.puppycrawl.tools.checkstyle.checks.naming.parametername; -public class InputAccessModifier { +public class InputParameterNameAccessModifier { - public InputAccessModifier(int pubconstr) {} + public InputParameterNameAccessModifier(int pubconstr) {} public void v1(int h) { new Object () { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/parametername/InputOverrideAnnotation.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/parametername/InputParameterNameOverrideAnnotation.java index 3e7a91fce..65b6f5537 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/parametername/InputOverrideAnnotation.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/parametername/InputParameterNameOverrideAnnotation.java @@ -1,6 +1,6 @@ package com.puppycrawl.tools.checkstyle.checks.naming.parametername; -public class InputOverrideAnnotation { +public class InputParameterNameOverrideAnnotation { @Override public boolean equals(Object o) { @@ -23,9 +23,9 @@ public class InputOverrideAnnotation { private int field; private java.util.Set<String> packageNames; - InputOverrideAnnotation() {} // No NPE here! + InputParameterNameOverrideAnnotation() {} // No NPE here! - InputOverrideAnnotation(int field, java.util.Set<String> packageNames) {} // No NPE here! + InputParameterNameOverrideAnnotation(int field, java.util.Set<String> packageNames) {} // No NPE here! } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/newlineatendoffile/InputNewlineCrAtEndOfFile.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileCr.java index 8c097b1b0..93a56b99f 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/newlineatendoffile/InputNewlineCrAtEndOfFile.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileCr.java @@ -1 +1 @@ -////////////////////////////////////////////////////////////////////////////////
// Test case file for checkstyle.
// Created: 2015
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle.checks;
/**
* Test case for detection of an existing CR newline at EOF, using the
* NewlineAtEndOfFileCheck.
* @author Martin Steiger
**/
public interface InputNewlineCrAtEndOfFile
{
/** Test with ending with CR newline
*/
}
\ No newline at end of file +////////////////////////////////////////////////////////////////////////////////
// Test case file for checkstyle.
// Created: 2015
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle.checks;
/**
* Test case for detection of an existing CR newline at EOF, using the
* NewlineAtEndOfFileCheck.
* @author Martin Steiger
**/
public interface InputNewlineAtEndOfFileCr
{
/** Test with ending with CR newline
*/
}
\ No newline at end of file diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/newlineatendoffile/InputNewlineCrlfAtEndOfFile.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileCrlf.java index fd93ac691..ed80f200a 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/newlineatendoffile/InputNewlineCrlfAtEndOfFile.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileCrlf.java @@ -2,13 +2,13 @@ // Test case file for checkstyle. // Created: 2015 //////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle.checks.misc.newlineatendoffile; +package com.puppycrawl.tools.checkstyle.checks.newlineatendoffile; /** * Test case for detection of an existing CRLF newline at EOF, using the * NewlineAtEndOfFileCheck. * @author Martin Steiger **/ -public interface InputNewlineCrlfAtEndOfFile +public interface InputNewlineAtEndOfFileCrlf { } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/newlineatendoffile/InputEmptyFile.txt b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileEmptyFile.txt index e69de29bb..e69de29bb 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/newlineatendoffile/InputEmptyFile.txt +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileEmptyFile.txt diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/newlineatendoffile/InputNewlineLfAtEndOfFile.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileLf.java index bc8a9f8ce..115d0fc8c 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/newlineatendoffile/InputNewlineLfAtEndOfFile.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileLf.java @@ -2,13 +2,13 @@ // Test case file for checkstyle. // Created: 2015 //////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle.checks.misc.newlineatendoffile; +package com.puppycrawl.tools.checkstyle.checks.newlineatendoffile; /** * Test case for detection of an existing LF newline at EOF, using the * NewlineAtEndOfFileCheck. * @author Martin Steiger **/ -public interface InputNewlineLfAtEndOfFile +public interface InputNewlineAtEndOfFileLf { } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileNewlineAtEnd.txt index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileNewlineAtEnd.txt diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/newlineatendoffile/InputNoNewlineAtEndOfFile.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileNoNewline.java index dbcb78f92..5a3327ecd 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/newlineatendoffile/InputNoNewlineAtEndOfFile.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileNoNewline.java @@ -2,13 +2,13 @@ // Test case file for checkstyle. // Created: 2003 //////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle.checks.misc.newlineatendoffile; +package com.puppycrawl.tools.checkstyle.checks.newlineatendoffile; /** * Test case for detection of missing newlines at EOF, using the * NewlineAtEndOfFileCheck. * @author Christopher Lenz **/ -public interface InputNoNewlineAtEndOfFile +public interface InputNewlineAtEndOfFileNoNewline { }
\ No newline at end of file diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilename1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilename1.java index c6ff0b966..c30a04622 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilename1.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilename1.java @@ -1,5 +1,5 @@ // someexamples of 1.5 extensions -package com.puppycrawl.tools.checkstyle.checks.misc.outertypefilename; +package com.puppycrawl.tools.checkstyle.checks.outertypefilename; public class InputOuterTypeFilename1 { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilename15Extensions.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilename15Extensions.java index 7f367f265..ab9f09f1c 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilename15Extensions.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilename15Extensions.java @@ -1,5 +1,5 @@ // someexamples of 1.5 extensions -package com.puppycrawl.tools.checkstyle.checks.misc.outertypefilename; +package com.puppycrawl.tools.checkstyle.checks.outertypefilename; @interface MyAnnotation1 { String name(); diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilename2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilename2.java index 5e018530b..54d427933 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilename2.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilename2.java @@ -1,5 +1,5 @@ // someexamples of 1.5 extensions -package com.puppycrawl.tools.checkstyle.checks.misc.outertypefilename; +package com.puppycrawl.tools.checkstyle.checks.outertypefilename; public class InputOuterTypeFilename2 { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilename3.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilename3.java index 844c62595..a8503fbcd 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilename3.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilename3.java @@ -1,5 +1,5 @@ // someexamples of 1.5 extensions -package com.puppycrawl.tools.checkstyle.checks.misc.outertypefilename; +package com.puppycrawl.tools.checkstyle.checks.outertypefilename; class InputOuterTypeFilename3 { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilename5.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilename5.java index 2b15f81c2..2c4cf17bd 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilename5.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilename5.java @@ -1,5 +1,5 @@ // someexamples of 1.5 extensions -package com.puppycrawl.tools.checkstyle.checks.misc.outertypefilename; +package com.puppycrawl.tools.checkstyle.checks.outertypefilename; class InputOuterTypeFilenameCheckWrongName2 { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilenameCheckPublic.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilenameCheckPublic.java new file mode 100644 index 000000000..5626b921e --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilenameCheckPublic.java @@ -0,0 +1,12 @@ +// someexamples of 1.5 extensions +package com.puppycrawl.tools.checkstyle.checks.outertypefilename; + +class UnicClassName { + +} + +public class InputOuterTypeFilenameCheckPublic { + + +} + diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilenameIllegalTokens.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilenameIllegalTokens.java index 76bc70442..26728b831 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/outertypefilename/InputOuterTypeFilenameIllegalTokens.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/outertypefilename/InputOuterTypeFilenameIllegalTokens.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.outertypefilename; +package com.puppycrawl.tools.checkstyle.checks.outertypefilename; public class InputOuterTypeFilenameIllegalTokens { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/regexp/regexponfilename/package-info.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/regexp/regexponfilename/package-info.java new file mode 100644 index 000000000..221822606 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/regexp/regexponfilename/package-info.java @@ -0,0 +1 @@ +package com.puppycrawl.tools.checkstyle.checks.regexp.regexponfilename; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/linelength/InputLongImportStatements.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/linelength/InputLineLengthLongImportStatements.java index 79585b29f..2897d5bc9 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/linelength/InputLongImportStatements.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/linelength/InputLineLengthLongImportStatements.java @@ -3,7 +3,7 @@ package com.puppycrawl.tools.checkstyle.checks.sizes.linelength; import com.puppycrawl.tools.checkstyle.grammars.comments.InputFullOfSinglelineComments; import static com.puppycrawl.tools.checkstyle.grammars.comments.InputFullOfSinglelineComments.main; -public class InputLongImportStatements { +public class InputLineLengthLongImportStatements { @Override public String toString() { return "This is very long line that should be logged because it is not import"; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/methodcount/InputMethodCount7.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/methodcount/InputMethodCount7.java new file mode 100644 index 000000000..aa7930b26 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/methodcount/InputMethodCount7.java @@ -0,0 +1,25 @@ +public class InputMethodCount7 { + void method1() { + } + + void method2() { + } + + enum InnerEnum { + ; + + public static void test1() { + Runnable r = (new Runnable() { + public void run() { + run2(); + } + + private void run2() { + } + }); + } + + public static void test2() { + } + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/methodlength/InputMethodLengthComments.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/methodlength/InputMethodLengthComments.java new file mode 100644 index 000000000..8fbcc0e1d --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/methodlength/InputMethodLengthComments.java @@ -0,0 +1,27 @@ +package com.puppycrawl.tools.checkstyle.checks.sizes.methodlength; + +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; + +public class InputMethodLengthComments { + public void visitToken(DetailAST ast) { + + final DetailAST openingBrace = ast.findFirstToken(TokenTypes.SLIST); + + if (openingBrace != null) { + final DetailAST closingBrace = + openingBrace.findFirstToken(TokenTypes.RCURLY); + } + + } + + public DetailAST visit(DetailAST ast) { + final DetailAST openingBrace = ast.findFirstToken(TokenTypes.SLIST); + DetailAST closingBrace = null; + + if (openingBrace != null) { + closingBrace = openingBrace.findFirstToken(TokenTypes.RCURLY); + } + return closingBrace; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/suppresswarnings/InputSuppressWarningsHolder.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolder.java index 8e34d5481..b83e1b2a2 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/suppresswarnings/InputSuppressWarningsHolder.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolder.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.suppresswarnings; +package com.puppycrawl.tools.checkstyle.checks.suppresswarningsholder; public class InputSuppressWarningsHolder { static final String UNUSED = "unused"; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/suppresswarnings/InputSuppressWarningsHolder2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolder2.java index 72897d066..023c76fb0 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/suppresswarnings/InputSuppressWarningsHolder2.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolder2.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.suppresswarnings; +package com.puppycrawl.tools.checkstyle.checks.suppresswarningsholder; public class InputSuppressWarningsHolder2 { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/suppresswarnings/InputSuppressWarningsHolder3.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolder3.java index b01109221..ca7a027d9 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/suppresswarnings/InputSuppressWarningsHolder3.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolder3.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.suppresswarnings; +package com.puppycrawl.tools.checkstyle.checks.suppresswarningsholder; public class InputSuppressWarningsHolder3 { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/suppresswarnings/InputSuppressWarningsHolder4.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolder4.java index 09204330d..e84e70656 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/suppresswarnings/InputSuppressWarningsHolder4.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolder4.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.suppresswarnings; +package com.puppycrawl.tools.checkstyle.checks.suppresswarningsholder; public class InputSuppressWarningsHolder4 { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/suppresswarnings/InputSuppressWarningsHolder5.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolder5.java index 2f0ebcf15..bdf134927 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/suppresswarnings/InputSuppressWarningsHolder5.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolder5.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.suppresswarnings; +package com.puppycrawl.tools.checkstyle.checks.suppresswarningsholder; import java.lang.annotation.ElementType; import java.lang.annotation.Target; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/todocomment/InputTodoCommentSimple.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/todocomment/InputTodoCommentSimple.java index 111cc4d0f..7982ac4d0 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/todocomment/InputTodoCommentSimple.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/todocomment/InputTodoCommentSimple.java @@ -3,7 +3,7 @@ // Created: Feb-2001 // Ignore error //////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle.checks.misc.todocomment; +package com.puppycrawl.tools.checkstyle.checks.todocomment; import java.io.*; /** * Contains simple mistakes: diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/trailingcomment/InputTrailingComment.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/trailingcomment/InputTrailingComment.java index 55b01001c..a7882dbef 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/trailingcomment/InputTrailingComment.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/trailingcomment/InputTrailingComment.java @@ -1,4 +1,4 @@ -package com.puppycrawl.tools.checkstyle.checks.misc.trailingcomment; +package com.puppycrawl.tools.checkstyle.checks.trailingcomment; public class InputTrailingComment { int i; // don't use trailing comments :) diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels.translations b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels.properties index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels.translations +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_de.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels.translations index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_de.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels.translations diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_de.translations b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_de.properties index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_de.translations +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_de.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_es.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_de.translations index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_es.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_de.translations diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_es.translations b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_es.properties index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_es.translations +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_es.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_fr_CA_UNIX.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_es.translations index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_fr_CA_UNIX.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_es.translations diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_fr_CA_UNIX.translations b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_fr_CA_UNIX.properties index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_fr_CA_UNIX.translations +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_fr_CA_UNIX.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_ja.translations b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_fr_CA_UNIX.translations index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/ButtonLabels_ja.translations +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_fr_CA_UNIX.translations diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/MyLabelsI18.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_ja.translations index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/MyLabelsI18.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ButtonLabels_ja.translations diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/InputTranslationCheckFireErrors.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/InputTranslationCheckFireErrors.properties new file mode 100644 index 000000000..074b0afab --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/InputTranslationCheckFireErrors.properties @@ -0,0 +1,2 @@ +someKey=Some key +anotherKey=one more diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_translation_de.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/InputTranslationCheckFireErrors_de.properties index 9bc87ab8d..9bc87ab8d 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_translation_de.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/InputTranslationCheckFireErrors_de.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/app-dev.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/InputTranslation_de.txt index 9a7ae0711..9a7ae0711 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/app-dev.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/InputTranslation_de.txt diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/MyLabelsI18_de.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/MyLabelsI18.properties index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/MyLabelsI18_de.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/MyLabelsI18.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/MyLabelsI18_es.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/MyLabelsI18_de.properties index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/MyLabelsI18_es.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/MyLabelsI18_de.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/PageTitles.translation b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/MyLabelsI18_es.properties index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/PageTitles.translation +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/MyLabelsI18_es.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckLinux.xml b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckLinux.xml new file mode 100644 index 000000000..34a16cbbe --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckLinux.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<checkstyle version="8.3-SNAPSHOT"> +<file name="path_to_file/InputTranslationCheckFireErrors.properties"> +</file> +<file name="path_to_file/InputTranslationCheckFireErrors_de.properties"> +</file> +<file name="path_to_file"> +<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/> +</file> +<file name="path_to_file/InputTranslationCheckFireErrors.properties"> +</file> +<file name="path_to_file/InputTranslationCheckFireErrors_de.properties"> +<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/> +</file> +</checkstyle> diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckMacOS.xml b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckMacOS.xml new file mode 100644 index 000000000..865791fde --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckMacOS.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<checkstyle version="8.3-SNAPSHOT"> +<file name="path_to_file/InputTranslationCheckFireErrors.properties"> +</file> +<file name="path_to_file/InputTranslationCheckFireErrors_de.properties"> +</file> +<file name="path_to_file"> +<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/> +</file> +<file name="path_to_file/InputTranslationCheckFireErrors_de.properties"> +<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/> +</file> +<file name="path_to_file/InputTranslationCheckFireErrors.properties"> +</file> +</checkstyle> diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckWindows.xml b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckWindows.xml new file mode 100644 index 000000000..443bba39b --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckWindows.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<checkstyle version="8.3-SNAPSHOT"> +<file name="path_to_file\InputTranslationCheckFireErrors.properties"> +</file> +<file name="path_to_file\InputTranslationCheckFireErrors_de.properties"> +</file> +<file name="path_to_file"> +<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/> +</file> +<file name="path_to_file\InputTranslationCheckFireErrors.properties"> +</file> +<file name="path_to_file\InputTranslationCheckFireErrors_de.properties"> +<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/> +</file> +</checkstyle> diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/PageTitles_de.translation b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/PageTitles.translation index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/PageTitles_de.translation +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/PageTitles.translation diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/PageTitles_es.translation b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/PageTitles_de.translation index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/PageTitles_es.translation +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/PageTitles_de.translation diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/PageTitles_fr.translation b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/PageTitles_es.translation index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/PageTitles_fr.translation +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/PageTitles_es.translation diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/PageTitles_ja.translation b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/PageTitles_fr.translation index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/PageTitles_ja.translation +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/PageTitles_fr.translation diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_home.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/PageTitles_ja.translation index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_home.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/PageTitles_ja.translation diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_test_de.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/app-dev.properties index 9a7ae0711..9a7ae0711 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_test_de.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/app-dev.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/app-stage.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/app-stage.properties index a82290c28..a82290c28 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/app-stage.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/app-stage.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages-translation.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages-translation.properties index c2499856b..c2499856b 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages-translation.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages-translation.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages-translation_fr.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages-translation_fr.properties index bb6e9fb38..bb6e9fb38 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages-translation_fr.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages-translation_fr.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_home_es_US.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_home.properties index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_home_es_US.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_home.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_home_fr_CA_UNIX.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_home_es_US.properties index 8b1378917..8b1378917 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_home_fr_CA_UNIX.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_home_es_US.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_home_fr_CA_UNIX.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_home_fr_CA_UNIX.properties new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_home_fr_CA_UNIX.properties @@ -0,0 +1 @@ + diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_test.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_test.properties index a82290c28..a82290c28 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_test.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_test.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_test_de.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_test_de.properties new file mode 100644 index 000000000..9a7ae0711 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_test_de.properties @@ -0,0 +1,12 @@ +# input file for TranslationCheck + +# a key that is available in all translations +hello=Hallo + +# whitespace at end of key should be trimmed before comparing. +# the german translation does not contain whitespace, no error should +# be reported here +cancel=Abbrechen + +# a key that is missing in german translation +#only.english=only english diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_translation.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_translation.properties index c2499856b..c2499856b 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_translation.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_translation.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_translation_de.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_translation_de.properties new file mode 100644 index 000000000..9bc87ab8d --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_translation_de.properties @@ -0,0 +1 @@ +someKey=einige Schlüssel diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_translation_ja.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_translation_ja.properties index dd01ae7df..dd01ae7df 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/translation/messages_translation_ja.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/messages_translation_ja.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/uncommentedmain/InputUncommentedMain.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uncommentedmain/InputUncommentedMain.java index 4f5efa013..a1422256d 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/uncommentedmain/InputUncommentedMain.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uncommentedmain/InputUncommentedMain.java @@ -2,7 +2,7 @@ // Test case file for checkstyle. // Created: 2003 //////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle.checks.misc.uncommentedmain; +package com.puppycrawl.tools.checkstyle.checks.uncommentedmain; /** * Test case for UncommentedMainCheck diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/uncommentedmain/InputUncommentedMain2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uncommentedmain/InputUncommentedMain2.java index 9ffb2792e..2b0f96b46 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/uncommentedmain/InputUncommentedMain2.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uncommentedmain/InputUncommentedMain2.java @@ -2,7 +2,7 @@ // Test case file for checkstyle. // Created: 2003 //////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle.checks.misc.uncommentedmain; +package com.puppycrawl.tools.checkstyle.checks.uncommentedmain; public class InputUncommentedMain2 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/uncommentedmain/InputUncommentedMain3.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uncommentedmain/InputUncommentedMain3.java index 7da0bb43c..cc72d4de9 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/uncommentedmain/InputUncommentedMain3.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uncommentedmain/InputUncommentedMain3.java @@ -2,7 +2,7 @@ // Test case file for checkstyle. // Created: 2003 //////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle.checks.misc.uncommentedmain; +package com.puppycrawl.tools.checkstyle.checks.uncommentedmain; class oneMoreClass { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/uncommentedmain/InputUncommentedMain4.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uncommentedmain/InputUncommentedMain4.java index e2ed74999..70528e075 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/uncommentedmain/InputUncommentedMain4.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uncommentedmain/InputUncommentedMain4.java @@ -2,7 +2,7 @@ // Test case file for checkstyle. // Created: 2003 //////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle.checks.misc.uncommentedmain; +package com.puppycrawl.tools.checkstyle.checks.uncommentedmain; class InputUncommentedMainTest4 { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uncommentedmain/InputUncommentedMain5.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uncommentedmain/InputUncommentedMain5.java new file mode 100644 index 000000000..f617d0e81 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uncommentedmain/InputUncommentedMain5.java @@ -0,0 +1,30 @@ +package com.puppycrawl.tools.checkstyle.checks.uncommentedmain; + +public class InputUncommentedMain5 +{ + public static void main(String[] args) + { + System.identityHashCode("InputUncommentedMain.main()"); + } +} + +class PC { + + // uncommented main with depth 2 + public static void main(String[] args) + { + System.identityHashCode("PC.main()"); + } + + //lets go deeper + private class PC2 { + + // uncommented main with depth 3 + public void main(String[] args) + { + System.identityHashCode("PC.main()"); + } + + + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/uniqueproperties/InputUniqueProperties.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uniqueproperties/InputUniqueProperties.properties index 6e921e9b2..6e921e9b2 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/uniqueproperties/InputUniqueProperties.properties +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uniqueproperties/InputUniqueProperties.properties diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uniqueproperties/InputUniqueProperties.txt b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uniqueproperties/InputUniqueProperties.txt new file mode 100644 index 000000000..120bc85f8 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uniqueproperties/InputUniqueProperties.txt @@ -0,0 +1,2 @@ +1=val +1=foo diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uniqueproperties/InputUniquePropertiesWithDuplicates.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uniqueproperties/InputUniquePropertiesWithDuplicates.properties new file mode 100644 index 000000000..36b0d8461 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uniqueproperties/InputUniquePropertiesWithDuplicates.properties @@ -0,0 +1,3 @@ +host=localhost +key=value1 +key=value2
\ No newline at end of file diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uniqueproperties/InputUniquePropertiesWithoutErrors.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uniqueproperties/InputUniquePropertiesWithoutErrors.properties new file mode 100644 index 000000000..48580bfcc --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/uniqueproperties/InputUniquePropertiesWithoutErrors.properties @@ -0,0 +1,2 @@ +key1=value1 +key2=value2 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/upperell/InputUpperEllSemantic.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/upperell/InputUpperEllSemantic.java index 737febb6f..b8360d33d 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/misc/upperell/InputUpperEllSemantic.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/upperell/InputUpperEllSemantic.java @@ -2,7 +2,7 @@ // Test case file for checkstyle. // Created: 2001 //////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle.checks.misc.upperell; +package com.puppycrawl.tools.checkstyle.checks.upperell; import java.awt.*; import java.io.ByteArrayOutputStream; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/emptylineseparator/InputEmptyLineSeparatorPrePreviousLineIsEmpty.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/emptylineseparator/InputEmptyLineSeparatorPrePreviousLineIsEmpty.java new file mode 100644 index 000000000..a80435c96 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/emptylineseparator/InputEmptyLineSeparatorPrePreviousLineIsEmpty.java @@ -0,0 +1,6 @@ + + +package com.puppycrawl.tools.checkstyle.checks.whitespace.emptylineseparator; + +public class InputEmptyLineSeparatorPrePreviousLineIsEmpty { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/emptylineseparator/InputEmptyLineSeparatorPreviousLineEmptiness.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/emptylineseparator/InputEmptyLineSeparatorPreviousLineEmptiness.java new file mode 100644 index 000000000..d8ab51dd0 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/emptylineseparator/InputEmptyLineSeparatorPreviousLineEmptiness.java @@ -0,0 +1,34 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace.emptylineseparator; + +public class InputEmptyLineSeparatorPreviousLineEmptiness { + private static final int MULTIPLICATOR; + + private int base; + + static { + MULTIPLICATOR = 5; + + + } + + { + + + base = 33; + } + + public InputEmptyLineSeparatorPreviousLineEmptiness(int base) { + + + this.base = base; + } + + public InputEmptyLineSeparatorPreviousLineEmptiness() { + } + + public static int increment(int value) { + + + return value * MULTIPLICATOR + 1; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/genericwhitespace/InputGenericWhitespaceAtStartOfTheLine.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/genericwhitespace/InputGenericWhitespaceAtStartOfTheLine.java new file mode 100644 index 000000000..466a0f813 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/genericwhitespace/InputGenericWhitespaceAtStartOfTheLine.java @@ -0,0 +1,15 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace.genericwhitespace; + +import java.util.Collections; + +class InputGenericWhitespaceAtStartOfTheLine { + + public String getConstructor(Class<?>... parameterTypes) + { + Collections.<Object + >emptySet(); + Collections. + <Object>emptySet(); + return "pitest makes me cry"; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/genericwhitespace/InputGenericWhitespaceNested.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/genericwhitespace/InputGenericWhitespaceNested.java new file mode 100644 index 000000000..79fd3f7e0 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/genericwhitespace/InputGenericWhitespaceNested.java @@ -0,0 +1,12 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace.genericwhitespace; + +public class InputGenericWhitespaceNested { + interface IntEnum { /*inner enum*/} + + interface NumberEnum<T> { /*inner enum*/} + + static class IntEnumValue implements IntEnum, NumberEnum<Integer> {} + + static class IntEnumValueType<E extends Enum<E +>& IntEnum & NumberEnum<E>> {} +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfter.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfter.java index ac31e2e42..4cdd50621 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfter.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfter.java @@ -286,4 +286,9 @@ class SpecialCasesInForLoop public static void testNoWhitespaceBeforeEllipses(String ... args) { } + @ interface BAD{} + @ interface BAD2{} + @ + interface BAD3{} + @interface Ok{} } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfterArrayDeclarations.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfterArrayDeclarations.java index e1fdeef74..9ba53befb 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfterArrayDeclarations.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfterArrayDeclarations.java @@ -43,4 +43,15 @@ public class InputNoWhitespaceAfterArrayDeclarations private long getLongMultArray(int someParam, String value) [][][] { //Incorrect return null; } + int aa = new int[]{1}[0];//Correct + int bb = new int[]{1} [0];//Incorrect + int aaa = new int[][]{{1},{2}}[0][0];//Correct + int bbb = new int [][]{{1},{2}}[0][0];//Incorrect + int ccc = new int[] []{{1},{2}}[0][0];//Incorrect + int ddd = new int[][]{{1},{2}} [0][0];//Incorrect + int eee = new int[][]{{1},{2}}[0] [0];//Incorrect + int in1 = new int[][]{{1},{2}}[ 0][0];//Correct + int in2 = new int[][]{{1},{2}}[0 ][0];//Correct + int in3 = new int[][]{{1},{2}}[0][ 0];//Correct + int in4 = new int[][]{{1},{2}}[0][0 ];//Correct } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfterArrayDeclarations3.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfterArrayDeclarations3.java new file mode 100644 index 000000000..7ed823aa3 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfterArrayDeclarations3.java @@ -0,0 +1,16 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace.nowhitespaceafter; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +public class InputNoWhitespaceAfterArrayDeclarations3 +{ + public void testWithAnnotationInMidle1(final char @AnnotationAfterTest [] a) {}//Correct + public void testWithAnnotationInMidle2(final char@AnnotationAfterTest [] a) {}//Correct + public void testWithAnnotationInMidle3(final char @AnnotationAfterTest[] a) {}//Correct + public void testWithAnnotationInMidle4(final char@AnnotationAfterTest[]a) {}//Correct + + @Target(ElementType.TYPE_USE) + @interface AnnotationAfterTest { + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespacebefore/InputNoWhitespaceBeforeAtStartOfTheLine.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespacebefore/InputNoWhitespaceBeforeAtStartOfTheLine.java new file mode 100644 index 000000000..f79da888a --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespacebefore/InputNoWhitespaceBeforeAtStartOfTheLine.java @@ -0,0 +1,16 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace +.nowhitespacebefore; + +import java.util.function.Supplier; + +public class InputNoWhitespaceBeforeAtStartOfTheLine { + public static class A { + private A() { + } + } + + public <V> void methodName(V value) { + Supplier<?> t = +A ::new; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespacebefore/InputNoWhitespaceBeforeEmptyForLoop.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespacebefore/InputNoWhitespaceBeforeEmptyForLoop.java new file mode 100644 index 000000000..ff240c905 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespacebefore/InputNoWhitespaceBeforeEmptyForLoop.java @@ -0,0 +1,22 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace.nowhitespacebefore; + +public class InputNoWhitespaceBeforeEmptyForLoop { + + public static void f() { + for (; ; ) { // OK + break; + } + for (int x = 0; ; ) { // OK + break; + } + for (int x = 0 ; ; ) { // VIOLATION + break; + } + for (int x = 0; x < 10; ) { // OK + break; + } + for (int x = 0; x < 10 ; ) { // VIOLATION + break; + } + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/parenpad/InputParenPadStartOfTheLine.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/parenpad/InputParenPadStartOfTheLine.java new file mode 100644 index 000000000..7ebcd6e49 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/parenpad/InputParenPadStartOfTheLine.java @@ -0,0 +1,8 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace.parenpad; + +public class InputParenPadStartOfTheLine { +public String checkSmth( String +a) { + return a + 1; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/parenpad/InputParenPadTryWithResources.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/parenpad/InputParenPadTryWithResources.java new file mode 100644 index 000000000..b45f2f4a3 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/parenpad/InputParenPadTryWithResources.java @@ -0,0 +1,12 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace.parenpad; + +class InputParenPadTryWithResources { + private void tryWithResources() throws Exception { + try (AutoCloseable a = null) {} // ok + try (AutoCloseable a = null; AutoCloseable b = null) {} // ok + try (AutoCloseable a = null; AutoCloseable b = null; ) {} // ok + try (AutoCloseable a = null; AutoCloseable b = null; ) {} // ok + try (AutoCloseable a = null ) {} // warning + try (AutoCloseable a = null; AutoCloseable b = null ) {} // warning + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorChildNodes.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorChildNodes.java new file mode 100644 index 000000000..3afd53f2b --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorChildNodes.java @@ -0,0 +1,6 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace.singlespaceseparator; + +public class InputSingleSpaceSeparatorChildNodes { + int j = 0; + int i = 1 + j; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceErrors.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorErrors.java index b789b5170..015197fa9 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceErrors.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorErrors.java @@ -3,7 +3,7 @@ package com.puppycrawl. tools.checkstyle.checks.whitespace.singlespaceseparat import java.util.List; import java.util.Vector; -public class InputSingleSpaceErrors { +public class InputSingleSpaceSeparatorErrors { int number; //violation int i = 99 ; { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorMinColumnNo.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorMinColumnNo.java new file mode 100644 index 000000000..7239ae0b3 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorMinColumnNo.java @@ -0,0 +1,6 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace.singlespaceseparator; + +public class InputSingleSpaceSeparatorMinColumnNo { + int +j = 0; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorStartOfTheLine.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorStartOfTheLine.java new file mode 100644 index 000000000..9d990a86a --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorStartOfTheLine.java @@ -0,0 +1,6 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace.singlespaceseparator; + +public class InputSingleSpaceSeparatorStartOfTheLine { + int + i = 0; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputAllowEmptyTypesAndNonEmptyClasses.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundAllowEmptyTypesAndNonEmptyClasses.java index b6b5ed63b..8a63dd289 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputAllowEmptyTypesAndNonEmptyClasses.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundAllowEmptyTypesAndNonEmptyClasses.java @@ -3,7 +3,7 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespacearound; import java.util.function.Function; import java.util.function.Supplier; -public class InputAllowEmptyTypesAndNonEmptyClasses{ +public class InputWhitespaceAroundAllowEmptyTypesAndNonEmptyClasses{ private Object object; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputBraces.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundBraces.java index f52aa6a43..c1f411d63 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputBraces.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundBraces.java @@ -4,7 +4,7 @@ //////////////////////////////////////////////////////////////////////////////// package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespacearound; -class InputBraces +class InputWhitespaceAroundBraces { /** @return helper func **/ boolean condition() @@ -108,7 +108,7 @@ class InputBraces } /** Empty constructor block. **/ - public InputBraces() {} + public InputWhitespaceAroundBraces() {} /** Empty method block. **/ public void emptyImplementation() {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputGenerics.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundGenerics.java index 22aa290f6..8d4190188 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputGenerics.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundGenerics.java @@ -3,7 +3,7 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespacearound; import java.util.Collection; import java.util.Map; -public class InputGenerics<A, B extends Collection<?>, C extends D&E, F extends Collection<? extends InputGenerics[]>> +public class InputWhitespaceAroundGenerics<A, B extends Collection<?>, C extends D&E, F extends Collection<? extends InputWhitespaceAroundGenerics[]>> { } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundStartOfTheLine.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundStartOfTheLine.java new file mode 100644 index 000000000..0833d9ee5 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundStartOfTheLine.java @@ -0,0 +1,8 @@ +package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespacearound; + +public class InputWhitespaceAroundStartOfTheLine { + public void checkSmth( +){ + final int SOMETHING = 1; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundVarargs.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundVarargs.java new file mode 100644 index 000000000..1334dfd7a --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespacearound/InputWhitespaceAroundVarargs.java @@ -0,0 +1,16 @@ +//////////////////////////////////////////////////////////////////////////////// +// Test case file for checkstyle. +// Created: 2017 +//////////////////////////////////////////////////////////////////////////////// +package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespacearound; + +class InputWhitespaceAroundVarargs +{ + public static void main0(String... args) { } + public static void main1(String ...args) { } + public static void main2(String...args) { } + public static void main3(String ... args) { } + public void varargs(int...arr) { } + public void doubleValue(int a, int...b) { } + +} |