View Javadoc
1   package com.google.checkstyle.test.chapter3filestructure.rule32packagestate; // ok
2   import java.io.*;
3   final class InputLineLength
4   {
5       // Long line ---------------------------------------------------------------------------------------- //warn
6       // Contains a tab ->    <-
7       // Contains trailing whitespace ->
8   
9       // Name format tests
10      //
11      /** Invalid format **/
12      public static final int badConstant = 2;
13      /** Valid format **/
14      public static final int MAX_ROWS = 2;
15  
16      /** Invalid format **/
17      private static int badStatic = 2;
18      /** Valid format **/
19      private static int sNumCreated = 0;
20  
21      /** Invalid format **/
22      private int badMember = 2;
23      /** Valid format **/
24      private int mNumCreated1 = 0;
25      /** Valid format **/
26      protected int mNumCreated2 = 0;
27  
28      /** commas are wrong **/
29      private int[] mInts = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; //warn
30      
31      /**
32       * Very long url: https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java
33       */
34      public void fooMethod() {}
35      
36      /**
37       * Long url without wrapping: http://ftp.dlink.ru/pub/D-Link_Solutions/D-Link_Solutions_for_Business.pdf
38       */
39      public void fooMethodLongFtp() {}
40      
41      public void fooLongStringUrl() {
42          String url = "https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java"; //ok
43          processUrl("https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java"); //ok
44          processUrl("some line"
45                  + "https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java" //ok
46                  + "+ long fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo00000000000o line"); //warn
47          processUrl("Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line"); //warn
48          String[] soooooooooooooooooooooooooooooooooooolongfooooooooooooooooooooooooooooooooooooooooooo = { //warn
49              "http://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java", //ok
50              "Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line", //warn
51          };
52          
53          String fakehttps = "Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line"; //warn
54          
55          processUrl(new String[] {
56              "http://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java", //ok
57              "Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line", //warn
58          });
59          
60          String s = "text"
61                  + "text"
62                  + "text something more.. <a href=\"https://groups.google.com/forum/#!topic/checkstyle-devel/E0z89fzvxGs%5B226-250-false%5D\">long url name, long url name, long url name</a>" //ok
63                  + "other text";
64      }
65      
66      /**
67       * 
68       * @param url
69       */
70      public void processUrl(String url) {}
71  
72      /**
73       * 
74       * @param urls
75       */
76      public void processUrl(String[] urls){}
77  }