View Javadoc
1   package com.google.checkstyle.test.chapter5naming.rule53camelcase;
2   
3   class InputFormattedCamelCaseDefined {
4   
5     int newCustomerId;
6   
7     String innerStopwatch;
8   
9     boolean supportsIpv6OnIos;
10  
11    void XmlHttpRequest() {}
12  
13    // violation 2 lines above 'Method name 'XmlHttpRequest' must match pattern'
14  
15    void YouTubeImporter() {}
16  
17    // violation 2 lines above 'Method name 'YouTubeImporter' must match pattern'
18  
19    void YoutubeImporter() {}
20  
21    // violation 2 lines above 'Method name 'YoutubeImporter' must match pattern'
22  
23    class InnerGood {
24  
25      int newCustomerId;
26  
27      String innerStopwatch;
28  
29      boolean supportsIpv6OnIos;
30  
31      void XmlHttpRequest() {}
32  
33      // violation 2 lines above 'Method name 'XmlHttpRequest' must match pattern'
34  
35      void YouTubeImporter() {}
36  
37      // violation 2 lines above 'Method name 'YouTubeImporter' must match pattern'
38  
39      void YoutubeImporter() {}
40      // violation above 'Method name 'YoutubeImporter' must match pattern'
41    }
42  
43    InputFormattedCamelCaseDefined anonymousGood =
44        new InputFormattedCamelCaseDefined() {
45  
46          int newCustomerId;
47  
48          String innerStopwatch;
49  
50          boolean supportsIpv6OnIos;
51  
52          void XmlHttpRequest() {}
53  
54          // violation 2 lines above 'Method name 'XmlHttpRequest' must match pattern'
55  
56          void YouTubeImporter() {}
57  
58          // violation 2 lines above 'Method name 'YouTubeImporter' must match pattern'
59  
60          void YoutubeImporter() {}
61          // violation above 'Method name 'YoutubeImporter' must match pattern'
62        };
63  
64    class AbbreviationsIncorrect {
65  
66      int newCustomerID;
67      // violation above 'newCustomerID.* more than '1' .* capital letters.'
68  
69      boolean supportsIPv6OnIOS;
70  
71      // violation 2 lines above 'supportsIPv6OnIOS.* more than '1' .* capital letters.'
72  
73      void XMLHTTPRequest() {}
74  
75      // 2 violations 2 lines above:
76      //  'XMLHTTPRequest.* more than '1' .* capital letters.'
77      //  'Method name 'XMLHTTPRequest' must match pattern'
78  
79      class InnerBad {
80  
81        int newCustomerID;
82        // violation above 'newCustomerID.* more than '1' .* capital letters.'
83  
84        boolean supportsIPv6OnIOS;
85  
86        // violation 2 lines above 'supportsIPv6OnIOS.* more than '1' .* capital letters.'
87  
88        void XMLHTTPRequest() {}
89        // 2 violations above:
90        //  'XMLHTTPRequest.* more than '1' .* capital letters.'
91        //  'Method name 'XMLHTTPRequest' must match pattern'
92      }
93  
94      InputFormattedCamelCaseDefined anonymousBad =
95          new InputFormattedCamelCaseDefined() {
96  
97            int newCustomerID;
98            // violation above 'newCustomerID.* more than '1' .* capital letters.'
99  
100           boolean supportsIPv6OnIOS;
101 
102           // violation 2 lines above 'supportsIPv6OnIOS.* more than '1' .* capital letters.'
103 
104           void XMLHTTPRequest() {}
105           // 2 violations above:
106           //  'XMLHTTPRequest.* more than '1' .* capital letters.'
107           //  'Method name 'XMLHTTPRequest' must match pattern'
108         };
109   }
110 }