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