From edb810c10e121b34f4222a4bba9012add00f1e41 Mon Sep 17 00:00:00 2001 From: Michal Kordas Date: Wed, 11 Nov 2015 00:05:03 +0100 Subject: [PATCH] Issue #2541: Clean up input files to not use forbidden APIs --- pom.xml | 16 --- .../InputRightCurlyOther.java | 8 +- .../InputEmptyBlockBasic.java | 42 +++--- .../InputEmptyCatchBlockNoViolations.java | 8 +- .../InputOneStatementPerLine.java | 2 +- ...VariableDeclarationUsageDistanceCheck.java | 18 +-- .../rule4842fallthrough/InputFallThrough.java | 8 +- ...tsIndentationCommentIsAtTheEndOfBlock.java | 12 +- ...InputCommentsIndentationInSwitchBlock.java | 2 +- .../InputNoFinalizeExtend.java | 2 +- .../checks/blocks/RightCurlyCheckTest.java | 8 +- .../checkstyle/checks/InputSemantic.java | 2 +- .../checks/InputUncommentedMain.java | 18 +-- .../checks/InputUncommentedMain2.java | 6 +- .../checks/InputUncommentedMain3.java | 2 +- .../checks/InputUncommentedMain4.java | 2 +- .../InputBracesSingleLineStatements.java | 4 +- .../checks/blocks/InputEmptyCatchBlock.java | 8 +- .../checks/blocks/InputLeftCurlyOther.java | 2 +- .../checks/blocks/InputNeedBraces.java | 4 +- .../checks/blocks/InputNestedBlocks.java | 2 +- .../InputRightCurlyAloneOrSingleline.java | 6 +- .../blocks/InputRightCurlyAnnotations.java | 6 +- .../checks/blocks/InputSemantic2.java | 2 +- .../checks/coding/InputFallThrough.java | 14 +- .../checks/coding/InputFallThrough2.java | 6 +- .../coding/InputFinalLocalVariable.java | 2 +- .../InputFinalLocalVariableNameShadowing.java | 2 +- .../InputFinalLocalVariableNativeMethods.java | 4 +- .../checks/coding/InputModifiedControl.java | 2 +- .../coding/InputMultipleStringLiterals.java | 2 +- .../coding/InputOneStatementPerLine.java | 2 +- .../checks/coding/InputRequireThis.java | 2 +- .../coding/InputUnnecessaryParentheses.java | 4 +- ...InputVariableDeclarationUsageDistance.java | 124 +++++++++--------- .../design/InputDesignForExtension.java | 16 +-- .../checks/design/InputInnerClass.java | 6 +- .../checks/design/InputNonUtilityClass.java | 2 +- .../indentation/InputBraceAdjustment.java | 2 +- ...InputCommentsIndentationInSwitchBlock.java | 2 +- .../indentation/InputInvalidLabelIndent.java | 12 +- .../indentation/InputInvalidMethodIndent.java | 10 +- .../indentation/InputInvalidSwitchIndent.java | 12 +- .../indentation/InputInvalidTryIndent.java | 30 ++--- .../checks/indentation/InputUseTwoSpaces.java | 2 +- .../indentation/InputValidBlockIndent.java | 2 +- .../indentation/InputValidCommaIndent.java | 2 +- .../indentation/InputValidDotIndent.java | 2 +- .../indentation/InputValidLabelIndent.java | 6 +- .../indentation/InputValidMethodIndent.java | 14 +- .../indentation/InputValidSwitchIndent.java | 14 +- .../indentation/InputValidTryIndent.java | 28 ++-- .../checks/javadoc/InputScopeAnonInner.java | 6 +- .../InputBooleanExpressionComplexityNPE.java | 2 +- .../checks/metrics/InputJavaNCSS.java | 4 +- .../checks/sizes/InputAnonInnerLength.java | 66 +++++----- .../whitespace/InputParenPadWithSpace.java | 2 +- .../whitespace/InputWhitespaceAround.java | 2 +- 58 files changed, 291 insertions(+), 307 deletions(-) diff --git a/pom.xml b/pom.xml index 944ae71a5..5eff210b0 100644 --- a/pom.xml +++ b/pom.xml @@ -893,24 +893,8 @@ **/Main.class **/Input* - **/*Input.class - **/New* **/CompareTreesWithComments.class - **/UpdateClass.class - **/bug* - **/oneMoreClass.class - **/RightCurlyInput_Other.class - **/test_* - **/WithInner$Inner.class - **/Foo* - **/WithAnon$1.class - **/UncommentedMainTest* - **/Temp* - **/Issue* - **/Main1.class **/ConfigurationBuilder.class - **/WithAnonymousClass$1.class - **/Test.class diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyOther.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyOther.java index 6c8ea7d6f..56a837919 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyOther.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyOther.java @@ -75,12 +75,12 @@ class InputRightCurlyOther { boolean flag = true; if (flag) { - System.out.println("heh"); - flag = !flag; } System.err. - println("Xe-xe"); + System.identityHashCode("heh"); + flag = !flag; } System. + identityHashCode("Xe-xe"); - if (flag) { System.err.println("some foo"); } + if (flag) { System.identityHashCode("some foo"); } } //ok } //ok diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlockBasic.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlockBasic.java index 0100d19eb..5e45ea28e 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlockBasic.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlockBasic.java @@ -23,7 +23,7 @@ class UpdateClass IO in = new IO(); while ((r = in.read()) != null) {} // ok for (; index < s.length && s[index] != 'x'; index++) {} // ok - if (a == 1) {} else {System.out.println("a");} // warn + if (a == 1) {} else {System.identityHashCode("a");} // warn do {} while(a == 1); //ok switch (a) {} //warn int[] z = {}; // ok @@ -72,7 +72,7 @@ class WithInner IO in = new IO(); while ((r = in.read()) != null) {} // ok for (; index < s.length && s[index] != 'x'; index++) {} // ok - if (a == 1) {} else {System.out.println("a");} // warn + if (a == 1) {} else {System.identityHashCode("a");} // warn do {} while(a == 1); //ok switch (a) {} //warn int[] z = {}; // ok @@ -102,7 +102,7 @@ class WithAnon IO in = new IO(); while ((r = in.read()) != null) {} // ok for (; index < s.length && s[index] != 'x'; index++) {} // ok - if (a == 1) {} else {System.out.println("a");} // warn + if (a == 1) {} else {System.identityHashCode("a");} // warn do {} while(a == 1); //ok switch (a) {} //warn int[] z = {}; // ok @@ -122,21 +122,21 @@ class NewClass { int a = 1; if (a == 1) { - System.out.println("a"); + System.identityHashCode("a"); } else {} // warn if (a == 1) { - System.out.println("a"); + System.identityHashCode("a"); } else {/*ignore*/} // OK if (a == 1) { /*ignore*/ } else { - System.out.println("a"); + System.identityHashCode("a"); } // ok if (a == 1) { - System.out.println("a"); + System.identityHashCode("a"); } else if (a != 1) { /*ignore*/ } else { @@ -146,7 +146,7 @@ class NewClass { if (a == 1) { /*ignore*/ } else if (a != 1) { - System.out.println("a"); + System.identityHashCode("a"); } else { /*ignore*/ } @@ -156,7 +156,7 @@ class NewClass { } else if (a != 1) { /*ignore*/ } else { - System.out.println("a"); + System.identityHashCode("a"); } if (a == 1) { @@ -191,21 +191,21 @@ class NewClass { int a = 1; if (a == 1) { - System.out.println("a"); + System.identityHashCode("a"); } else {} // warn if (a == 1) { - System.out.println("a"); + System.identityHashCode("a"); } else {/*ignore*/} // OK if (a == 1) { /*ignore*/ } else { - System.out.println("a"); + System.identityHashCode("a"); } // ok if (a == 1) { - System.out.println("a"); + System.identityHashCode("a"); } else if (a != 1) { /*ignore*/ } else { @@ -215,7 +215,7 @@ class NewClass { if (a == 1) { /*ignore*/ } else if (a != 1) { - System.out.println("a"); + System.identityHashCode("a"); } else { /*ignore*/ } @@ -225,7 +225,7 @@ class NewClass { } else if (a != 1) { /*ignore*/ } else { - System.out.println("a"); + System.identityHashCode("a"); } if (a == 1) { @@ -260,21 +260,21 @@ class NewClass { int a = 1; if (a == 1) { - System.out.println("a"); + System.identityHashCode("a"); } else {} // warn if (a == 1) { - System.out.println("a"); + System.identityHashCode("a"); } else {/*ignore*/} // OK if (a == 1) { /*ignore*/ } else { - System.out.println("a"); + System.identityHashCode("a"); } // ok if (a == 1) { - System.out.println("a"); + System.identityHashCode("a"); } else if (a != 1) { /*ignore*/ } else { @@ -284,7 +284,7 @@ class NewClass { if (a == 1) { /*ignore*/ } else if (a != 1) { - System.out.println("a"); + System.identityHashCode("a"); } else { /*ignore*/ } @@ -294,7 +294,7 @@ class NewClass { } else if (a != 1) { /*ignore*/ } else { - System.out.println("a"); + System.identityHashCode("a"); } if (a == 1) { diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockNoViolations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockNoViolations.java index 6229a1feb..c481739f8 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockNoViolations.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockNoViolations.java @@ -24,7 +24,7 @@ public class InputEmptyCatchBlockNoViolations return; } catch (Exception e) { - System.out.println(e); + System.identityHashCode(e); return; } finally @@ -41,11 +41,11 @@ public class InputEmptyCatchBlockNoViolations int e=u-y; } catch (IllegalArgumentException e) { - System.out.println(e); //some comment + System.identityHashCode(e); //some comment return; } catch (IllegalStateException ex) { - System.out.println(ex); + System.identityHashCode(ex); return; } } @@ -58,7 +58,7 @@ public class InputEmptyCatchBlockNoViolations int e=u-y; } catch (IllegalArgumentException e) { - System.out.println(e); + System.identityHashCode(e); return; } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java index e87f25167..bf77830bb 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java @@ -31,7 +31,7 @@ public class InputOneStatementPerLine { public void doLegalString() { one = 1; two = 2; - System.out.println("one = 1; two = 2"); + System.identityHashCode("one = 1; two = 2"); } /** diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/InputVariableDeclarationUsageDistanceCheck.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/InputVariableDeclarationUsageDistanceCheck.java index 873e6fea2..dbe608891 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/InputVariableDeclarationUsageDistanceCheck.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/InputVariableDeclarationUsageDistanceCheck.java @@ -88,7 +88,7 @@ public class InputVariableDeclarationUsageDistanceCheck { String ar[] = { "1", "2" }; for (String st : ar) { - System.out.println(st); + System.identityHashCode(st); } } @@ -381,11 +381,11 @@ public class InputVariableDeclarationUsageDistanceCheck { int filterCount = 0; for (int i = 0; i < 10; i++, filterCount++) { int abc = 0; - System.out.println(abc); + System.identityHashCode(abc); for (int j = 0; j < 10; j++) { abc = filterCount; - System.out.println(abc); + System.identityHashCode(abc); } } } @@ -482,7 +482,7 @@ public class InputVariableDeclarationUsageDistanceCheck { options.addBindFile(null); options.addBindFile(null); options.addBindFile(null); - System.out.println("message"); + System.identityHashCode("message"); myOption.setArgName("abc"); // distance=7 } @@ -504,15 +504,15 @@ public class InputVariableDeclarationUsageDistanceCheck { int count = 0; String[] files = {}; - System.out.println("Data archivation started"); + System.identityHashCode("Data archivation started"); files.notify(); - System.out.println("sss"); + System.identityHashCode("sss"); if (files == null || files.length == 0) { - System.out.println("No files on a remote site"); + System.identityHashCode("No files on a remote site"); } else { - System.out.println("Files on remote site: " + files.length); + System.identityHashCode("Files on remote site: " + files.length); for (String ftpFile : files) { if (files.length == 0) { @@ -523,7 +523,7 @@ public class InputVariableDeclarationUsageDistanceCheck { } } - System.out.println(); + System.lineSeparator(); return count; } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/InputFallThrough.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/InputFallThrough.java index 4877727d0..864f7661f 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/InputFallThrough.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/InputFallThrough.java @@ -52,12 +52,12 @@ public class InputFallThrough } case 15: //warn do { - System.out.println("something"); + System.identityHashCode("something"); return; } while(true); case 16: for (int j1 = 0; j1 < 10; j1++) { - System.err.println("something"); + System.identityHashCode("something"); return; } case 17: @@ -185,12 +185,12 @@ public class InputFallThrough // fallthru case 15: do { - System.out.println("something"); + System.identityHashCode("something"); return; } while(true); case 16: for (int j1 = 0; j1 < 10; j1++) { - System.err.println("something"); + System.identityHashCode("something"); return; } case 17: diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationCommentIsAtTheEndOfBlock.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationCommentIsAtTheEndOfBlock.java index 5dbac5d27..8b7057a2a 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationCommentIsAtTheEndOfBlock.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationCommentIsAtTheEndOfBlock.java @@ -145,7 +145,7 @@ public class InputCommentsIndentationCommentIsAtTheEndOfBlock { for (int i = 0; i < 5; i++) { org.junit.Assert.assertEquals(expected.get(i), array[i]); } - String s = String.format("The array element " + String s = String.format(java.util.Locale.ENGLISH, "The array element " + "immediately following the end of the collection should be nulled", array[1]); // the above example was taken from hibernate-orm and was modified a bit @@ -158,7 +158,7 @@ public class InputCommentsIndentationCommentIsAtTheEndOfBlock { for (int i = 0; i < 5; i++) { org.junit.Assert.assertEquals(expected.get(i), array[i]); } - String s = String.format("The array element " + String s = String.format(java.util.Locale.ENGLISH, "The array element " + "immediately following the end of the collection should be nulled", array[1]); // warn @@ -175,13 +175,13 @@ public class InputCommentsIndentationCommentIsAtTheEndOfBlock { } public String foo25() { - return String.format("%d", + return String.format(java.util.Locale.ENGLISH, "%d", 1); // comment } public String foo26() { - return String.format("%d", + return String.format(java.util.Locale.ENGLISH, "%d", 1); // warn } @@ -196,14 +196,14 @@ public class InputCommentsIndentationCommentIsAtTheEndOfBlock { public String foo28() { int a = 5; - return String.format("%d", + return String.format(java.util.Locale.ENGLISH, "%d", 1); // comment } public String foo29() { int a = 5; - return String.format("%d", + return String.format(java.util.Locale.ENGLISH, "%d", 1); // warn } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInSwitchBlock.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInSwitchBlock.java index 4acbe634a..3ce959b5d 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInSwitchBlock.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInSwitchBlock.java @@ -66,7 +66,7 @@ public class InputCommentsIndentationInSwitchBlock { int a; } // warn - case "18": { System.out.println(); + case "18": { System.lineSeparator(); } // trailing comment case "19": // comment diff --git a/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizeExtend.java b/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizeExtend.java index c4281d83f..75c003550 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizeExtend.java +++ b/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizeExtend.java @@ -113,7 +113,7 @@ class WithAnonymousClass { Ball b = new Ball() { public void hit() { - System.out.println("You hit it!"); + System.identityHashCode("You hit it!"); } protected void finalize() { //warn diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java index a8d4bb698..99ed06508 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java @@ -214,8 +214,8 @@ public class RightCurlyCheckTest extends BaseCheckTestSupport { "188:13: " + getCheckMessage(MSG_KEY_LINE_NEW, "}", 13), "197:9: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 9), "197:10: " + getCheckMessage(MSG_KEY_LINE_NEW, "}", 10), - "201:49: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 49), - "201:50: " + getCheckMessage(MSG_KEY_LINE_NEW, "}", 50), + "201:54: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 54), + "201:55: " + getCheckMessage(MSG_KEY_LINE_NEW, "}", 55), "204:75: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 75), "204:76: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 76), "204:77: " + getCheckMessage(MSG_KEY_LINE_NEW, "}", 77), @@ -245,8 +245,8 @@ public class RightCurlyCheckTest extends BaseCheckTestSupport { "148:13: " + getCheckMessage(MSG_KEY_LINE_NEW, "}", 13), "157:9: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 9), "157:10: " + getCheckMessage(MSG_KEY_LINE_NEW, "}", 10), - "161:49: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 49), - "161:50: " + getCheckMessage(MSG_KEY_LINE_NEW, "}", 50), + "161:54: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 54), + "161:55: " + getCheckMessage(MSG_KEY_LINE_NEW, "}", 55), "164:75: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 75), "164:76: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 76), "164:77: " + getCheckMessage(MSG_KEY_LINE_NEW, "}", 77), diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputSemantic.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputSemantic.java index 978963767..b85c912b3 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputSemantic.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputSemantic.java @@ -66,7 +66,7 @@ class InputSemantic // can never happen, empty compound statement is another workaround } catch (UnsupportedOperationException handledException) { - System.out.println(handledException.getMessage()); + System.identityHashCode(handledException.getMessage()); } catch (SecurityException ex) { /* hello */ } catch (StringIndexOutOfBoundsException ex) {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain.java index 646a1a211..4c7ad1f83 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain.java @@ -13,7 +13,7 @@ public class InputUncommentedMain // uncommented main public static void main(String[] args) { - System.out.println("InputUncommentedMain.main()"); + System.identityHashCode("InputUncommentedMain.main()"); } } @@ -22,7 +22,7 @@ class Main1 // uncommented main in class Main public static void main(String[] args) { - System.out.println("Main.main()"); + System.identityHashCode("Main.main()"); } } @@ -31,7 +31,7 @@ class UncommentedMainTest1 // one more uncommented main public static void main(java.lang.String[] args) { - System.out.println("test1.main()"); + System.identityHashCode("test1.main()"); } } @@ -40,7 +40,7 @@ class UncommentedMainTest2 // wrong arg type public static void main(int args) { - System.out.println("test2.main()"); + System.identityHashCode("test2.main()"); } } @@ -49,7 +49,7 @@ class UncommentedMainTest3 // no-public main static void main(String[] args) { - System.out.println("test3.main()"); + System.identityHashCode("test3.main()"); } } @@ -58,7 +58,7 @@ class UncommentedMainTest4 // non-static main public void main(String[] args) { - System.out.println("test4.main()"); + System.identityHashCode("test4.main()"); } } @@ -67,7 +67,7 @@ class UncommentedMainTest5 // wrong return type public static int main(String[] args) { - System.out.println("test5.main()"); + System.identityHashCode("test5.main()"); return 1; } } @@ -77,7 +77,7 @@ class UncommentedMainTest6 // too many params public static void main(String[] args, int param) { - System.out.println("test6.main()"); + System.identityHashCode("test6.main()"); } } @@ -86,6 +86,6 @@ class UncommentedMainTest7 // main w/o params public static void main() { - System.out.println("test7.main()"); + System.identityHashCode("test7.main()"); } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain2.java index 831fb4a12..325ceb391 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain2.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain2.java @@ -12,7 +12,7 @@ public class InputUncommentedMain2 // uncommented main with depth 2 public void main(String[] args) { - System.out.println("InputUncommentedMain.main()"); + System.identityHashCode("InputUncommentedMain.main()"); } //lets go deeper @@ -21,7 +21,7 @@ public class InputUncommentedMain2 // uncommented main with depth 3 public void main(String[] args) { - System.out.println("InputUncommentedMain.main()"); + System.identityHashCode("InputUncommentedMain.main()"); } @@ -30,7 +30,7 @@ public class InputUncommentedMain2 public static void main(String[] args) { - System.out.println("InputUncommentedMain.main()"); + System.identityHashCode("InputUncommentedMain.main()"); } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain3.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain3.java index 70378c175..3152bac57 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain3.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain3.java @@ -8,6 +8,6 @@ class oneMoreClass { public static void anyWrongMethodName(String[] args) { - System.out.println("InputUncommentedMain.main()"); + System.identityHashCode("InputUncommentedMain.main()"); } } \ No newline at end of file diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain4.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain4.java index 9f8dbe070..4e363b3c7 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain4.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/InputUncommentedMain4.java @@ -9,6 +9,6 @@ class InputUncommentedMainTest4 // one more uncommented main public static void main(int[] args) { - System.out.println("test1.main()"); + System.identityHashCode("test1.main()"); } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputBracesSingleLineStatements.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputBracesSingleLineStatements.java index 6260ddd82..84e8e7eb2 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputBracesSingleLineStatements.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputBracesSingleLineStatements.java @@ -82,8 +82,8 @@ public class InputBracesSingleLineStatements } private void testElse(int k) { - if (k == 4) System.out.println("yes"); - else System.out.println("no"); + if (k == 4) System.identityHashCode("yes"); + else System.identityHashCode("no"); for (;;); } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputEmptyCatchBlock.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputEmptyCatchBlock.java index 762deede3..c2ce15429 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputEmptyCatchBlock.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputEmptyCatchBlock.java @@ -81,7 +81,7 @@ public class InputEmptyCatchBlock return; } catch (Exception e) { - System.out.println(e); + System.identityHashCode(e); return; } finally @@ -112,11 +112,11 @@ public class InputEmptyCatchBlock int e=u-y; } catch (IllegalArgumentException e) { - System.out.println(e); //some comment + System.identityHashCode(e); //some comment return; } catch (IllegalStateException ex) { - System.out.println(ex); + System.identityHashCode(ex); return; } } @@ -129,7 +129,7 @@ public class InputEmptyCatchBlock int e=u-y; } catch (IllegalArgumentException e) { - System.out.println(e); + System.identityHashCode(e); return; } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputLeftCurlyOther.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputLeftCurlyOther.java index 42c51c7dd..5a29cab0e 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputLeftCurlyOther.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputLeftCurlyOther.java @@ -89,7 +89,7 @@ class InputLeftCurlyOther { boolean flag = true; if (flag) { - System.out.println("heh"); + System.identityHashCode("heh"); flag = !flag; } System.err. println("Xe-xe"); // it is ok to have rcurly on the same line as previous diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputNeedBraces.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputNeedBraces.java index 7e87cda6b..74a8f9ebd 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputNeedBraces.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputNeedBraces.java @@ -32,7 +32,7 @@ public class InputNeedBraces } switch(1) { - case 1: System.out.println(); + case 1: System.lineSeparator(); case 2: { break;} case 3: { @@ -41,7 +41,7 @@ public class InputNeedBraces case 4: break; - case 5: System.out.println(); + case 5: System.lineSeparator(); break; } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputNestedBlocks.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputNestedBlocks.java index 4be8c9da1..d0719610f 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputNestedBlocks.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputNestedBlocks.java @@ -54,7 +54,7 @@ class InputNestedBlocks case 3: // test fallthrough default: // Not OK, SLIST is not complete case body - System.out.println("Hello"); + System.identityHashCode("Hello"); { x = 2; } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputRightCurlyAloneOrSingleline.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputRightCurlyAloneOrSingleline.java index de27350d3..e982e59cd 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputRightCurlyAloneOrSingleline.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputRightCurlyAloneOrSingleline.java @@ -153,12 +153,12 @@ public class InputRightCurlyAloneOrSingleline { void foo25() { for (int i = 0; i < 10; i++) { - System.out.println("Hello, world!"); + System.identityHashCode("Hello, world!"); }} //violation void foo26() { for (int i = 0; i < 10; i++) { - System.out.println("Hello, world!");}} //violation + System.identityHashCode("Hello, world!");}} //violation void foo27() { for (int i = 0; i < 10; i++) {for (int j = 0; j < 15; j++) {int a;}}} //violation @@ -172,7 +172,7 @@ public class InputRightCurlyAloneOrSingleline { private void foo29() { boolean flag = true; if (flag) { - System.out.println("heh"); + System.identityHashCode("heh"); flag = !flag; } System.err. //violation println("Xe-xe"); } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputRightCurlyAnnotations.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputRightCurlyAnnotations.java index 7802a0274..03ccc4b2b 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputRightCurlyAnnotations.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputRightCurlyAnnotations.java @@ -193,12 +193,12 @@ class InputRightCurlyAnnotations void foo25() { for (int i = 0; i < 10; i++) { - System.out.println("Hello, world!"); + System.identityHashCode("Hello, world!"); }} //violation void foo26() { for (int i = 0; i < 10; i++) { - System.out.println("Hello, world!");}} //violation + System.identityHashCode("Hello, world!");}} //violation void foo27() { for (int i = 0; i < 10; i++) {for (int j = 0; j < 15; j++) {int a;}}} //violation @@ -212,7 +212,7 @@ class InputRightCurlyAnnotations private void foo29() { boolean flag = true; if (flag) { - System.out.println("heh"); + System.identityHashCode("heh"); flag = !flag; } System.err. //violation println("Xe-xe"); } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputSemantic2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputSemantic2.java index a85c38998..01b93dfda 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputSemantic2.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/blocks/InputSemantic2.java @@ -19,7 +19,7 @@ class UpdateClass if (doSideEffect() == 1) {} //is not OK, while ((a = index - 1) != 0) {} // is OK for (; index < s.length && s[index] != 'x'; index++) {} // is OK - if (a == 1) {} else {System.out.println("a");} // is not OK + if (a == 1) {} else {System.identityHashCode("a");} // is not OK switch (a) {} //warn switch (a) { //ok case 1: diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFallThrough.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFallThrough.java index 85f3d1544..bc302a047 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFallThrough.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFallThrough.java @@ -52,7 +52,7 @@ public class InputFallThrough } case 15: //fall through!!! do { - System.out.println("something"); + System.identityHashCode("something"); return; } while(true); case 16: @@ -185,7 +185,7 @@ public class InputFallThrough // fallthru case 15: do { - System.out.println("something"); + System.identityHashCode("something"); return; } while(true); case 16: @@ -422,7 +422,7 @@ public class InputFallThrough case 1: switch(hashCode()){} case 2: - System.out.println(); + System.lineSeparator(); break; } } @@ -431,20 +431,20 @@ public class InputFallThrough switch(hashCode()) { case 1: if (true) { - System.out.println(); + System.lineSeparator(); } case 2: - System.out.println(); + System.lineSeparator(); break; } } void noCommentAtTheEnd() { switch(hashCode()) { - case 1: System.out.println(); + case 1: System.lineSeparator(); case 2: - System.out.println(); + System.lineSeparator(); break; } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFallThrough2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFallThrough2.java index 968165f3e..2c8c9e92a 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFallThrough2.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFallThrough2.java @@ -26,7 +26,7 @@ public class InputFallThrough2 { case 0: case 1: case 2: - System.out.println(var2); + System.identityHashCode(var2); break; case 3: if (true) { @@ -59,14 +59,14 @@ public class InputFallThrough2 { } case 8: if(var2 == 5) { - System.out.println("0xB16B00B5"); + System.identityHashCode("0xB16B00B5"); } else { break; } case 9: if(var2 == 5) { - System.out.println("0xCAFED00D"); + System.identityHashCode("0xCAFED00D"); } else { System.out.printf("0x4B1D"); diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariable.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariable.java index 5d2513e0c..7c4d337d4 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariable.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariable.java @@ -148,7 +148,7 @@ class test_1241722 public void doSomething(Object _o) { - System.out.println(_o); + System.identityHashCode(_o); } public void doSomething2(Object _o1) diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariableNameShadowing.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariableNameShadowing.java index 5408f0318..79d40a158 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariableNameShadowing.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariableNameShadowing.java @@ -2,7 +2,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding; class Foo1 { public void foo(String text) { - System.out.println(text); + System.identityHashCode(text); class Bar { void bar (String text) { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariableNativeMethods.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariableNativeMethods.java index ece7fbe23..f8cf647fc 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariableNativeMethods.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFinalLocalVariableNativeMethods.java @@ -11,12 +11,12 @@ public class InputFinalLocalVariableNativeMethods public void print () { String str = nativeFoo(1, 4); - System.out.println(str); + System.identityHashCode(str); } public static void main(final String[] args) { (new InputFinalLocalVariableNativeMethods()).print(); - System.out.println("In Java, the average is " + + System.identityHashCode("In Java, the average is " + new InputFinalLocalVariableNativeMethods().average(3, 2)); return; } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputModifiedControl.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputModifiedControl.java index 51731b428..f47309948 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputModifiedControl.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputModifiedControl.java @@ -35,7 +35,7 @@ class InputModifiedControl Serializable s = new Serializable() { int i = 3; void a() { - System.out.println(i++); + System.identityHashCode(i++); } }; } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputMultipleStringLiterals.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputMultipleStringLiterals.java index 67d794059..aee8422a8 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputMultipleStringLiterals.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputMultipleStringLiterals.java @@ -11,7 +11,7 @@ public class InputMultipleStringLiterals void method1() { String a1 = "StringContents"; - System.out.println("StringContents"); + System.identityHashCode("StringContents"); // The following is not reported, since it is two string literals. String a2 = "String" + "Contents"; } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputOneStatementPerLine.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputOneStatementPerLine.java index c431cd1a2..52c9c4501 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputOneStatementPerLine.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputOneStatementPerLine.java @@ -85,7 +85,7 @@ public class InputOneStatementPerLine { public void doLegalString() { one = 1; two = 2; - System.out.println("one = 1; two = 2"); + System.identityHashCode("one = 1; two = 2"); } /** diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputRequireThis.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputRequireThis.java index e8cdbb7b7..cef9f5883 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputRequireThis.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputRequireThis.java @@ -102,7 +102,7 @@ class Issue257 { foo.read(); } catch (final IOException e) { - e.printStackTrace(); + e.getCause(); } } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputUnnecessaryParentheses.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputUnnecessaryParentheses.java index af9d00105..04f11ddd7 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputUnnecessaryParentheses.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputUnnecessaryParentheses.java @@ -10,7 +10,7 @@ public class InputUnnecessaryParentheses { } for (int i = (0+1); (i) < ((6+6)); i += (1+0)) { - System.out.println("hi"); + System.identityHashCode("hi"); } return (0); @@ -84,7 +84,7 @@ public class InputUnnecessaryParentheses { private void print(int arg) { - System.out.println("arg = " + arg); + System.identityHashCode("arg = " + arg); } static class TypeParameterized {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputVariableDeclarationUsageDistance.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputVariableDeclarationUsageDistance.java index ff223c802..39c8ff6d8 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputVariableDeclarationUsageDistance.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputVariableDeclarationUsageDistance.java @@ -88,7 +88,7 @@ public class InputVariableDeclarationUsageDistance { String ar[] = { "1", "2" }; for (String st : ar) { - System.out.println(st); + System.identityHashCode(st); } } @@ -381,11 +381,11 @@ public class InputVariableDeclarationUsageDistance { int filterCount = 0; for (int i = 0; i < 10; i++, filterCount++) { int abc = 0; - System.out.println(abc); + System.identityHashCode(abc); for (int j = 0; j < 10; j++) { abc = filterCount; - System.out.println(abc); + System.identityHashCode(abc); } } } @@ -482,7 +482,7 @@ public class InputVariableDeclarationUsageDistance { options.addBindFile(null); options.addBindFile(null); options.addBindFile(null); - System.out.println("message"); + System.identityHashCode("message"); myOption.setArgName("abc"); // distance=7 } @@ -504,15 +504,15 @@ public class InputVariableDeclarationUsageDistance { int count = 0; String[] files = {}; - System.out.println("Data archivation started"); + System.identityHashCode("Data archivation started"); files.notify(); - System.out.println("sss"); + System.identityHashCode("sss"); if (files == null || files.length == 0) { - System.out.println("No files on a remote site"); + System.identityHashCode("No files on a remote site"); } else { - System.out.println("Files on remote site: " + files.length); + System.identityHashCode("Files on remote site: " + files.length); for (String ftpFile : files) { if (files.length == 0) { @@ -523,7 +523,7 @@ public class InputVariableDeclarationUsageDistance { } } - System.out.println(); + System.lineSeparator(); return count; } @@ -553,13 +553,13 @@ public class InputVariableDeclarationUsageDistance { else { node = new TreeMapNode(label); } - System.out.println(id.toString() + node); - System.out.println(node.toString() + id); + System.identityHashCode(id.toString() + node); + System.identityHashCode(node.toString() + id); if (parentId == null || parentId == -1) { ///!!!!!!! root = node; } else { - System.out.println(parentId.toString() +node); + System.identityHashCode(parentId.toString() +node); } } return root; @@ -841,68 +841,68 @@ public class InputVariableDeclarationUsageDistance { class New { void a() { int a = 1; - System.out.println(); - System.out.println(); - System.out.println(); - System.out.println(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); while (true) { - System.out.println(); - System.out.println(a); + System.lineSeparator(); + System.identityHashCode(a); } } void b() { int a = 1; - System.out.println(); - System.out.println(); - System.out.println(); - System.out.println(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); do { - System.out.println(); - System.out.println(a); + System.lineSeparator(); + System.identityHashCode(a); } while (true); } void c() { int a = 1; - System.out.println(); - System.out.println(); - System.out.println(); - System.out.println(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); for (;;) { - System.out.println(); - System.out.println(a); + System.lineSeparator(); + System.identityHashCode(a); } } void d() { int a = 1; - System.out.println(); - System.out.println(); - System.out.println(); - System.out.println(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); for (int i: new int[]{1,2,3}) { - System.out.println(); - System.out.println(a); + System.lineSeparator(); + System.identityHashCode(a); } } void f() { int a = 1; - System.out.println(); - System.out.println(); - System.out.println(); - System.out.println(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); while (true) - System.out.println(a); + System.identityHashCode(a); } void h() { int a = 1; - System.out.println(); - System.out.println(); - System.out.println(); - System.out.println(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); while (true) while (true) a++; @@ -912,37 +912,37 @@ class New { int a = 1; switch (Math.max(1, 2)) { case 1: - System.out.println(); + System.lineSeparator(); break; case 2: - System.out.println(); + System.lineSeparator(); break; } switch (Math.max(1, 2)) { case 1: - System.out.println(a); + System.identityHashCode(a); break; case 2: - System.out.println(a); + System.identityHashCode(a); break; } } void k() { int a = 1; - System.out.println(); - System.out.println(); - System.out.println(); - System.out.println(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); while (true) { - System.out.println(); + System.lineSeparator(); if (true) { - System.out.println(); + System.lineSeparator(); } else if (true) { - System.out.println(a); + System.identityHashCode(a); } else { - System.out.println(); + System.lineSeparator(); } } } @@ -954,10 +954,10 @@ class New { switch (hashCode()){} switch (Math.max(1, 2)) { case 1: - System.out.println(a); + System.identityHashCode(a); break; case 2: - System.out.println(a); + System.identityHashCode(a); break; } } @@ -965,9 +965,9 @@ class New { void tryWithoutFinally() { int a = 1; - System.out.println(); - System.out.println(); - System.out.println(); + System.lineSeparator(); + System.lineSeparator(); + System.lineSeparator(); try { a = 2; } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputDesignForExtension.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputDesignForExtension.java index b35e0879e..0b3914d24 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputDesignForExtension.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputDesignForExtension.java @@ -21,7 +21,7 @@ public abstract class InputDesignForExtension { protected void finalThroughClassDef() { - System.out.println("no way to override"); + System.identityHashCode("no way to override"); } } @@ -36,7 +36,7 @@ public abstract class InputDesignForExtension private void aPrivateMethod() { - System.out.println("no way to override"); + System.identityHashCode("no way to override"); } protected abstract void nonFinalButAbstract(); @@ -45,7 +45,7 @@ public abstract class InputDesignForExtension protected void doh() { - System.out.println("nonempty and overriding possible"); + System.identityHashCode("nonempty and overriding possible"); } // has a potentially complex implementation in native code. @@ -55,12 +55,12 @@ public abstract class InputDesignForExtension public final void aFinalMethod() { - System.out.println("no way to override"); + System.identityHashCode("no way to override"); } public static void aStaticMethod() { - System.out.println("no way to override"); + System.identityHashCode("no way to override"); } // tries to trigger bug #884035 @@ -84,7 +84,7 @@ public abstract class InputDesignForExtension { public void someMethod() { - System.out.println("nonempty and overriding is possible"); + System.identityHashCode("nonempty and overriding is possible"); } } @@ -94,7 +94,7 @@ public abstract class InputDesignForExtension private nonFinalClass(){} public void someMethod() { - System.out.println("nonempty and overriding is possible"); + System.identityHashCode("nonempty and overriding is possible"); } } @@ -104,7 +104,7 @@ public abstract class InputDesignForExtension public anotherNonFinalClass(){} public void someMethod() { - System.out.println("nonempty and overriding is possible"); + System.identityHashCode("nonempty and overriding is possible"); } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputInnerClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputInnerClass.java index 61253fa30..d4e7f076b 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputInnerClass.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputInnerClass.java @@ -8,7 +8,7 @@ public class InputInnerClass { class InnerInMethod1 { void methodTest1() { - System.out.println("test1"); + System.identityHashCode("test1"); } } @@ -42,7 +42,7 @@ public class InputInnerClass { } void methodTest2() { //error - System.out.println("test2"); + System.identityHashCode("test2"); } } @@ -63,7 +63,7 @@ class Temp2 { } void methodTest2() { //error - System.out.println("test2"); + System.identityHashCode("test2"); } private int i = 0; //error diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputNonUtilityClass.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputNonUtilityClass.java index 57fa5e044..68c330722 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputNonUtilityClass.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/design/InputNonUtilityClass.java @@ -16,6 +16,6 @@ public class InputNonUtilityClass extends JPanel public static void utilMethod() { - System.out.println("I'm a utility method"); + System.identityHashCode("I'm a utility method"); } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputBraceAdjustment.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputBraceAdjustment.java index 7dd282c8a..fb510d3d7 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputBraceAdjustment.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputBraceAdjustment.java @@ -24,7 +24,7 @@ public class InputBraceAdjustment //indent:0 exp:0 boolean uglyGnuStyle = true; //indent:8 exp:8 if (uglyGnuStyle) //indent:8 exp:8 { //indent:10 exp:10 - System.out.println("ugly GNU style braces"); //indent:12 exp:12 + System.identityHashCode("ugly GNU style braces"); //indent:12 exp:12 } //indent:8 exp:10 warn } //indent:6 exp:6 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationInSwitchBlock.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationInSwitchBlock.java index eb9d9aded..69c419cfd 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationInSwitchBlock.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationInSwitchBlock.java @@ -66,7 +66,7 @@ public class InputCommentsIndentationInSwitchBlock { int a; } // violation - case "18": { System.out.println(); + case "18": { System.lineSeparator(); } // trailing comment case "19": // comment diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidLabelIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidLabelIndent.java index cf1d27589..7be34f839 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidLabelIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidLabelIndent.java @@ -22,21 +22,21 @@ public class InputInvalidLabelIndent { //indent:0 exp:0 while (test) { //indent:8 exp:8 label: //indent:10 exp:8,12 warn - System.out.println("label test"); //indent:12 exp:12 + System.identityHashCode("label test"); //indent:12 exp:12 if (test) { //indent:12 exp:12 unusedLabel: //indent:16 exp:16 - System.out.println("more testing"); //indent:16 exp:16 + System.identityHashCode("more testing"); //indent:16 exp:16 } //indent:12 exp:12 } //indent:8 exp:8 label2: //indent:2 exp:4,8 warn - System.out.println("toplevel"); //indent:8 exp:8 + System.identityHashCode("toplevel"); //indent:8 exp:8 label3: //indent:4 exp:4 - System.out.println("toplevel"); //indent:18 exp:8,12 warn - System.out.println("toplevel"); //indent:18 exp:8 warn + System.identityHashCode("toplevel"); //indent:18 exp:8,12 warn + System.identityHashCode("toplevel"); //indent:18 exp:8 warn label4: //indent:4 exp:4 - System.out.println("toplevel"); //indent:6 exp:8,12 warn + System.identityHashCode("toplevel"); //indent:6 exp:8,12 warn label5: //indent:4 exp:4 System //indent:6 exp:8,12 warn .out. //indent:12 exp:>=10 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidMethodIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidMethodIndent.java index ff428ae74..724329e3c 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidMethodIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidMethodIndent.java @@ -100,20 +100,20 @@ public class InputInvalidMethodIndent { //indent:0 exp:0 System.getProperty("foo"); //indent:10 exp:12 warn } //indent:6 exp:8 warn - System.out.println("methods are: " + //indent:8 exp:8 + System.identityHashCode("methods are: " + //indent:8 exp:8 Arrays.asList( //indent:10 exp:12 warn new String[] {"method"}).toString()); //indent:16 exp:>=14 - System.out.println("methods are: " + //indent:8 exp:8 + System.identityHashCode("methods are: " + //indent:8 exp:8 Arrays.asList( //indent:12 exp:>=12 new String[] {"method"}).toString()); //indent:14 exp:>=14 - System.out.println("methods are: " //indent:8 exp:8 + System.identityHashCode("methods are: " //indent:8 exp:8 + Arrays.asList( //indent:10 exp:12 warn new String[] {"method"}).toString()); //indent:16 exp:>=14 - System.out.println("methods are: " //indent:8 exp:8 + System.identityHashCode("methods are: " //indent:8 exp:8 + Arrays.asList( //indent:12 exp:>=12 new String[] {"method"}).toString()); //indent:14 exp:>=12 @@ -126,7 +126,7 @@ public class InputInvalidMethodIndent { //indent:0 exp:0 new String("type") //indent:10 exp:12 warn ); //indent:6 exp:8 warn - System.out.println("methods are: " + Arrays.asList( //indent:8 exp:8 + System.identityHashCode("methods are: " + Arrays.asList( //indent:8 exp:8 new String[] {"method"}).toString() //indent:12 exp:>=12 ); //indent:6 exp:8 warn } //indent:4 exp:4 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidSwitchIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidSwitchIndent.java index 6d73b0dd3..9585c5c2b 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidSwitchIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidSwitchIndent.java @@ -30,7 +30,7 @@ public class InputInvalidSwitchIndent { //indent:0 exp:0 switch (s) { //indent:6 exp:8 warn case 4: //indent:10 exp:12 warn - System.out.println(""); //indent:14 exp:16 warn + System.identityHashCode(""); //indent:14 exp:16 warn break; //indent:16 exp:16 case CONST: //indent:12 exp:12 @@ -41,7 +41,7 @@ public class InputInvalidSwitchIndent { //indent:0 exp:0 break; //indent:16 exp:16 default: //indent:10 exp:12 warn - System.out.println(""); //indent:14 exp:16 warn + System.identityHashCode(""); //indent:14 exp:16 warn break; //indent:14 exp:16 warn } //indent:8 exp:8 @@ -50,21 +50,21 @@ public class InputInvalidSwitchIndent { //indent:0 exp:0 switch (s) { //indent:8 exp:8 case 4: { //indent:12 exp:12 - System.out.println(""); //indent:14 exp:16 warn + System.identityHashCode(""); //indent:14 exp:16 warn break; //indent:18 exp:16 warn } //indent:10 exp:12 warn case CONST2: //indent:12 exp:12 case CONST3: //indent:12 exp:12 { //indent:10 exp:12 warn - System.out.println(""); //indent:16 exp:16 + System.identityHashCode(""); //indent:16 exp:16 break; //indent:16 exp:16 } //indent:14 exp:12 warn case 22: //indent:12 exp:12 { //indent:14 exp:12 warn - System.out.println(""); //indent:16 exp:16 + System.identityHashCode(""); //indent:16 exp:16 break; //indent:16 exp:16 } //indent:10 exp:12 warn } //indent:8 exp:8 @@ -80,7 +80,7 @@ public class InputInvalidSwitchIndent { //indent:0 exp:0 case //indent:12 exp:12 CONST3: //indent:14 exp:16 warn { //indent:12 exp:12 - System.out.println(""); //indent:16 exp:16 + System.identityHashCode(""); //indent:16 exp:16 break; //indent:16 exp:16 } //indent:12 exp:12 } //indent:8 exp:8 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidTryIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidTryIndent.java index 5e6da9768..0f4e6da47 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidTryIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidTryIndent.java @@ -24,26 +24,26 @@ public class InputInvalidTryIndent { //indent:0 exp:0 try { //indent:9 exp:8 warn } catch (Throwable t) { //indent:7 exp:8 warn - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } //indent:7 exp:8 warn try { //indent:4 exp:8 warn - System.out.println("test"); //indent:8 exp:12 warn + System.identityHashCode("test"); //indent:8 exp:12 warn } finally { //indent:4 exp:8 warn - System.out.println("finally"); //indent:8 exp:12 warn + System.identityHashCode("finally"); //indent:8 exp:12 warn } //indent:8 exp:8 try { //indent:8 exp:8 } catch (Throwable t) { //indent:8 exp:8 - System.out.println("err"); //indent:8 exp:12 warn + System.identityHashCode("err"); //indent:8 exp:12 warn } finally { //indent:8 exp:8 } //indent:8 exp:8 try { //indent:8 exp:8 } catch (Exception t) { //indent:10 exp:8 warn - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } catch (Throwable t) { //indent:6 exp:8 warn - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } //indent:8 exp:8 try { //indent:8 exp:8 @@ -53,31 +53,31 @@ public class InputInvalidTryIndent { //indent:0 exp:0 try { //indent:8 exp:8 - System.out.println("try"); //indent:12 exp:12 + System.identityHashCode("try"); //indent:12 exp:12 } //indent:8 exp:8 catch (Exception t) { //indent:8 exp:8 - System.out.println("err"); //indent:10 exp:12 warn - System.out.println("err"); //indent:14 exp:12 warn - System.out.println("err"); //indent:10 exp:12 warn + System.identityHashCode("err"); //indent:10 exp:12 warn + System.identityHashCode("err"); //indent:14 exp:12 warn + System.identityHashCode("err"); //indent:10 exp:12 warn } //indent:8 exp:8 catch (Throwable t) { //indent:6 exp:8 warn - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } //indent:8 exp:8 finally { //indent:8 exp:8 } //indent:8 exp:8 try //indent:8 exp:8 { //indent:10 exp:8 warn - System.out.println("try"); //indent:12 exp:12 + System.identityHashCode("try"); //indent:12 exp:12 } //indent:10 exp:8 warn catch (Exception t) //indent:8 exp:8 { //indent:6 exp:8 warn - System.out.println("err"); //indent:12 exp:12 - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } //indent:10 exp:8 warn catch (Throwable t) //indent:8 exp:8 { //indent:8 exp:8 - System.out.println("err"); //indent:10 exp:12 warn + System.identityHashCode("err"); //indent:10 exp:12 warn } //indent:8 exp:8 finally //indent:8 exp:8 { //indent:8 exp:8 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputUseTwoSpaces.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputUseTwoSpaces.java index 528bda87c..6a2caaf41 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputUseTwoSpaces.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputUseTwoSpaces.java @@ -33,7 +33,7 @@ public class InputUseTwoSpaces { //indent:0 exp:0 class Test { //indent:0 exp:0 public static void main(String[] args) { //indent:2 exp:2 - System.out.println(" Hello" + //indent:4 exp:4 + System.identityHashCode(" Hello" + //indent:4 exp:4 new Object() { //indent:6 exp:>=6 public String toString() { //indent:8 exp:8 return "World"; //indent:10 exp:10 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidBlockIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidBlockIndent.java index d85c26680..b2b4589e7 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidBlockIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidBlockIndent.java @@ -152,7 +152,7 @@ class bug1260079 //indent:0 exp:0 { //indent:8 exp:8 public void run() //indent:12 exp:12 { //indent:12 exp:12 - System.out.println("ran"); //indent:16 exp:16 + System.identityHashCode("ran"); //indent:16 exp:16 } //indent:12 exp:12 }.start(); //indent:8 exp:8 } //indent:4 exp:4 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidCommaIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidCommaIndent.java index 5de927ad6..d204ea12c 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidCommaIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidCommaIndent.java @@ -34,7 +34,7 @@ public class InputValidCommaIndent { //indent:0 exp:0 if ((j == 2 && k == 3) //indent:8 exp:8 || test) { //indent:14 exp:>=12 - System.out.println("test"); //indent:12 exp:12 + System.identityHashCode("test"); //indent:12 exp:12 } //indent:8 exp:8 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidDotIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidDotIndent.java index c334a0e53..c1373182b 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidDotIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidDotIndent.java @@ -22,7 +22,7 @@ public class InputValidDotIndent { //indent:0 exp:0 /** Creates a new instance of InputValidDotIndent */ //indent:4 exp:4 public InputValidDotIndent() { //indent:4 exp:4 - System.out.println(); //indent:8 exp:8 + System.lineSeparator(); //indent:8 exp:8 System. //indent:8 exp:8 out.println(); //indent:12 exp:12 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidLabelIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidLabelIndent.java index 4a35b2840..4e4872537 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidLabelIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidLabelIndent.java @@ -22,16 +22,16 @@ public class InputValidLabelIndent { //indent:0 exp:0 while (test) { //indent:8 exp:8 label: //indent:8 exp:8,12 - System.out.println("label test"); //indent:12 exp:12,16 + System.identityHashCode("label test"); //indent:12 exp:12,16 if (test) { //indent:12 exp:12 unusedLabel: //indent:12 exp:12 - System.out.println("more testing"); //indent:16 exp:16,20 + System.identityHashCode("more testing"); //indent:16 exp:16,20 } //indent:12 exp:12 } //indent:8 exp:8 label2: //indent:4 exp:4,8 - System.out.println("toplevel"); //indent:8 exp:8,12 + System.identityHashCode("toplevel"); //indent:8 exp:8,12 } //indent:4 exp:4 } //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidMethodIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidMethodIndent.java index 1822713d8..316299bc5 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidMethodIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidMethodIndent.java @@ -140,14 +140,14 @@ public class InputValidMethodIndent extends java.awt.event.MouseAdapter implemen void method6() { //indent:4 exp:4 - System.out.println("methods are: " + Arrays.asList( //indent:8 exp:8 + System.identityHashCode("methods are: " + Arrays.asList( //indent:8 exp:8 new String[] {"method"}).toString()); //indent:12 exp:>=12 - System.out.println("methods are: " + Arrays.asList( //indent:8 exp:8 + System.identityHashCode("methods are: " + Arrays.asList( //indent:8 exp:8 new String[] {"method"} //indent:12 exp:>=12 ).toString()); //indent:8 exp:8 - System.out.println("methods are: " + Arrays.asList( //indent:8 exp:8 + System.identityHashCode("methods are: " + Arrays.asList( //indent:8 exp:8 new String[] {"method"}).toString() //indent:12 exp:>=12 ); //indent:8 exp:8 @@ -158,11 +158,11 @@ public class InputValidMethodIndent extends java.awt.event.MouseAdapter implemen myfunc2(3, 4, method2(3, 4, 5, 6) + 5, //indent:8 exp:8 6, 7, 8, 9); //indent:12 exp:>=12 - System.out.println("methods are: " + //indent:8 exp:8 + System.identityHashCode("methods are: " + //indent:8 exp:8 Arrays.asList( //indent:12 exp:>=12 new String[] {"method"}).toString()); //indent:16 exp:>=16 - System.out.println("methods are: " //indent:8 exp:8 + System.identityHashCode("methods are: " //indent:8 exp:8 + Arrays.asList( //indent:12 exp:>=12 new String[] {"method"}).toString()); //indent:16 exp:>=16 @@ -170,11 +170,11 @@ public class InputValidMethodIndent extends java.awt.event.MouseAdapter implemen String blah = (String) System.getProperty( //indent:8 exp:8 new String("type")); //indent:12 exp:>=12 - System.out.println(method1() + "mytext" //indent:8 exp:8 + System.identityHashCode(method1() + "mytext" //indent:8 exp:8 + " at indentation level not at correct indentation, " //indent:12 exp:>=12 + method1()); //indent:12 exp:>=12 - System.out.println( //indent:8 exp:8 + System.identityHashCode( //indent:8 exp:8 method1() + "mytext" //indent:12 exp:>=12 + " at indentation level not at correct indentation, " //indent:16 exp:>=12 + method1()); //indent:16 exp:>=12 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidSwitchIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidSwitchIndent.java index 42e7948e9..a239e4a97 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidSwitchIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidSwitchIndent.java @@ -30,7 +30,7 @@ public class InputValidSwitchIndent { //indent:0 exp:0 switch (s) { //indent:8 exp:8 case 4: //indent:12 exp:12 - System.out.println(""); //indent:16 exp:16 + System.identityHashCode(""); //indent:16 exp:16 break; //indent:16 exp:16 case CONST: //indent:12 exp:12 @@ -41,7 +41,7 @@ public class InputValidSwitchIndent { //indent:0 exp:0 break; //indent:16 exp:16 default: //indent:12 exp:12 - System.out.println(""); //indent:16 exp:16 + System.identityHashCode(""); //indent:16 exp:16 break; //indent:16 exp:16 } //indent:8 exp:8 @@ -50,7 +50,7 @@ public class InputValidSwitchIndent { //indent:0 exp:0 switch (s) { //indent:8 exp:8 case 4: { //indent:12 exp:12 - System.out.println(""); //indent:16 exp:16 + System.identityHashCode(""); //indent:16 exp:16 break; //indent:16 exp:16 } //indent:12 exp:12 @@ -60,7 +60,7 @@ public class InputValidSwitchIndent { //indent:0 exp:0 case CONST2: //indent:12 exp:12 case CONST3: //indent:12 exp:12 { //indent:12 exp:12 - System.out.println(""); //indent:16 exp:16 + System.identityHashCode(""); //indent:16 exp:16 break; //indent:16 exp:16 } //indent:12 exp:12 @@ -73,7 +73,7 @@ public class InputValidSwitchIndent { //indent:0 exp:0 case //indent:12 exp:12 4: { //indent:16 exp:16 - System.out.println(""); //indent:16 exp:16 + System.identityHashCode(""); //indent:16 exp:16 break; //indent:16 exp:16 } //indent:12 exp:12 @@ -85,7 +85,7 @@ public class InputValidSwitchIndent { //indent:0 exp:0 case //indent:12 exp:12 CONST3: //indent:16 exp:16 { //indent:12 exp:12 - System.out.println(""); //indent:16 exp:16 + System.identityHashCode(""); //indent:16 exp:16 break; //indent:16 exp:16 } //indent:12 exp:12 @@ -99,7 +99,7 @@ public class InputValidSwitchIndent { //indent:0 exp:0 switch (s) { //indent:8 exp:8 default: //indent:12 exp:12 - System.out.println(""); //indent:16 exp:16 + System.identityHashCode(""); //indent:16 exp:16 break; //indent:16 exp:16 } //indent:8 exp:8 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidTryIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidTryIndent.java index 68f31e574..959fb07bf 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidTryIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidTryIndent.java @@ -24,26 +24,26 @@ public class InputValidTryIndent { //indent:0 exp:0 try { //indent:8 exp:8 } catch (Throwable t) { //indent:8 exp:8 - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } //indent:8 exp:8 try { //indent:8 exp:8 - System.out.println("test"); //indent:12 exp:12 + System.identityHashCode("test"); //indent:12 exp:12 } finally { //indent:8 exp:8 - System.out.println("finally"); //indent:12 exp:12 + System.identityHashCode("finally"); //indent:12 exp:12 } //indent:8 exp:8 try { //indent:8 exp:8 } catch (Throwable t) { //indent:8 exp:8 - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } finally { //indent:8 exp:8 } //indent:8 exp:8 try { //indent:8 exp:8 } catch (Exception t) { //indent:8 exp:8 - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } catch (Throwable t) { //indent:8 exp:8 - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } //indent:8 exp:8 try { //indent:8 exp:8 @@ -53,30 +53,30 @@ public class InputValidTryIndent { //indent:0 exp:0 try { //indent:8 exp:8 - System.out.println("try"); //indent:12 exp:12 + System.identityHashCode("try"); //indent:12 exp:12 } //indent:8 exp:8 catch (Exception t) { //indent:8 exp:8 - System.out.println("err"); //indent:12 exp:12 - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } //indent:8 exp:8 catch (Throwable t) { //indent:8 exp:8 - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } //indent:8 exp:8 finally { //indent:8 exp:8 } //indent:8 exp:8 try //indent:8 exp:8 { //indent:8 exp:8 - System.out.println("try"); //indent:12 exp:12 + System.identityHashCode("try"); //indent:12 exp:12 } //indent:8 exp:8 catch (Exception t) //indent:8 exp:8 { //indent:8 exp:8 - System.out.println("err"); //indent:12 exp:12 - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } //indent:8 exp:8 catch (Throwable t) //indent:8 exp:8 { //indent:8 exp:8 - System.out.println("err"); //indent:12 exp:12 + System.identityHashCode("err"); //indent:12 exp:12 } //indent:8 exp:8 finally //indent:8 exp:8 { //indent:8 exp:8 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputScopeAnonInner.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputScopeAnonInner.java index 913cf6a92..3de11834e 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputScopeAnonInner.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputScopeAnonInner.java @@ -25,7 +25,7 @@ public class InputScopeAnonInner private Runnable mRunnable = new Runnable() { public void run() // should not have to be documented, class is anon. { - System.out.println("running"); + System.identityHashCode("running"); } }; @@ -38,7 +38,7 @@ public class InputScopeAnonInner { public void mouseClicked( MouseEvent aEv ) { - System.out.println("click"); + System.identityHashCode("click"); } } ); } @@ -52,7 +52,7 @@ public class InputScopeAnonInner { public void mouseClicked( MouseEvent aEv ) { - System.out.println("click"); + System.identityHashCode("click"); } } ); } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/InputBooleanExpressionComplexityNPE.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/InputBooleanExpressionComplexityNPE.java index f7c5887d3..02e074f93 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/InputBooleanExpressionComplexityNPE.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/InputBooleanExpressionComplexityNPE.java @@ -4,7 +4,7 @@ public class InputBooleanExpressionComplexityNPE { static { try { - System.out.println("a"); + System.identityHashCode("a"); } catch (IllegalStateException | IllegalArgumentException e) { throw new RuntimeException(e); } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/InputJavaNCSS.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/InputJavaNCSS.java index f8ae29004..02b4450fe 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/InputJavaNCSS.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/InputJavaNCSS.java @@ -32,7 +32,7 @@ public class InputJavaNCSS { int a = 0; switch (a) { case 1: //falls through - case 2: System.out.println("Hello"); break; + case 2: System.identityHashCode("Hello"); break; default: break; } @@ -40,7 +40,7 @@ public class InputJavaNCSS { //should give an ncss of 2 public void itemStateChanged(ItemEvent e) { - System.out.println("Hello"); + System.identityHashCode("Hello"); } }; } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/InputAnonInnerLength.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/InputAnonInnerLength.java index 766a368d2..6dfb0a51b 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/InputAnonInnerLength.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/sizes/InputAnonInnerLength.java @@ -50,22 +50,22 @@ public class InputAnonInnerLength private Runnable mRunnable1 = new Runnable() { public void run() // should not have to be documented, class is anon. { - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); } }; @@ -75,21 +75,21 @@ public class InputAnonInnerLength private Runnable mRunnable2 = new Runnable() { public void run() // should not have to be documented, class is anon. { - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); - System.out.println("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); + System.identityHashCode("running"); } }; @@ -102,7 +102,7 @@ public class InputAnonInnerLength { public void mouseClicked( MouseEvent aEv ) { - System.out.println("click"); + System.identityHashCode("click"); } } ); } @@ -116,7 +116,7 @@ public class InputAnonInnerLength { public void mouseClicked( MouseEvent aEv ) { - System.out.println("click"); + System.identityHashCode("click"); } } ); } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/InputParenPadWithSpace.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/InputParenPadWithSpace.java index f7ff910b9..f42b7373c 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/InputParenPadWithSpace.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/InputParenPadWithSpace.java @@ -16,7 +16,7 @@ public class InputParenPadWithSpace { int[] i = new int[2]; for ( int j: i ) { - System.out.println ( j ); + System.identityHashCode ( j ); } } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/InputWhitespaceAround.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/InputWhitespaceAround.java index 0de832df9..a51031323 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/InputWhitespaceAround.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/InputWhitespaceAround.java @@ -17,7 +17,7 @@ public class InputWhitespaceAround { int[] i = new int[2]; for ( int j: i ) { - System.out.println ( j ); + System.identityHashCode ( j ); } } }