View Javadoc
1   /*
2   com.puppycrawl.tools.checkstyle.checks.SuppressWarningsHolder
3   aliasList = LineLengthCheck=line
4   
5   com.puppycrawl.tools.checkstyle.filters.SuppressWarningsFilter
6   
7   com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck
8   ignorePattern = ^ *\\* *[^ ]+$
9   
10  com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck
11  max = 75
12  
13  
14  */
15  
16  package com.puppycrawl.tools.checkstyle.checks.suppresswarningsholder;
17  
18  import static com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck.MSG_KEY;
19  // violation above, 'Line is longer than 80 characters'
20  
21  
22  public class InputSuppressWarningsHolderAlias6 {
23  
24      void testMethod(String str) {
25          str = MSG_KEY;
26          System.out.println("This is a short line.");
27  
28          System.out.println("This line is long and exceeds the default limit of 80 characters.");
29          // 2 violations above:
30          //  'Line is longer than 75 characters'
31          //  'Line is longer than 80 characters'
32      }
33  
34      @SuppressWarnings("Line")
35      void testMethod2(String str) {
36          str = MSG_KEY;
37          System.out.println("This is a short line.");
38  
39          System.out.println("This line is long and exceeds the default limit of 80 characters.");
40          // filtered 2 violations above:
41          //  'Line is longer than 75 characters'
42          //  'Line is longer than 80 characters'
43      }
44  
45      @SuppressWarnings("LIne")
46      void testMethod3(String str) {
47          str = MSG_KEY;
48          System.out.println("This is a short line.");
49  
50          System.out.println("This line exceeds the limit of 75 characters.");
51          // filtered violation above, 'Line is longer than 75 characters'
52      }
53  
54      void testMethod4(String str) {
55          str = MSG_KEY;
56          System.out.println("This is a short line.");
57  
58          System.out.println("This line exceeds the limit of 75 characters.");
59          // violation above, 'Line is longer than 75 characters'
60      }
61  
62      // violation 3 lines below 'Line is longer than 75 characters'
63      /**
64      * This is a short Javadoc comment.
65      * ThisJavadocCommentIsAReallyLongWordThatExceedsDefaultLineLimitOfEightyCharacters.
66      */
67      void testMethod5(String str) {
68          str = MSG_KEY;
69          System.out.println("This is a short line.");
70      }
71  
72      @SuppressWarnings("LINE")
73      // filtered violation 3 lines below, 'Line is longer than 75 characters'
74      /**
75      * This is a short Javadoc comment.
76      * ThisJavadocCommentIsAReallyLongWordThatExceedsDefaultLineLimitOfEightyCharacters.
77      */
78      void testMethod6(String str) {
79          str = MSG_KEY;
80          System.out.println("This is a short line.");
81      }
82  }