1 /* 2 MethodName 3 format = (default)^[a-z][a-zA-Z0-9]*$ 4 allowClassName = (default)false 5 applyToPublic = (default)true 6 applyToProtected = (default)true 7 applyToPackage = (default)true 8 applyToPrivate = (default)true 9 10 11 */ 12 13 package com.puppycrawl.tools.checkstyle.checks.naming.methodname; 14 import java.io.*; 15 /** 16 * Contains simple mistakes: 17 * - Long lines 18 * - Tabs 19 * - Format of variables and parameters 20 * - Order of modifiers 21 * @author Oliver Burn 22 **/ 23 final class InputMethodNameSimpleTwo { 24 25 /** constructor that is 10 lines long **/ 26 private InputMethodNameSimpleTwo() 27 { 28 // a line 29 // a line 30 // a line 31 // a line 32 // a line 33 // a line 34 // a line 35 // a line 36 } 37 38 /** test local variables */ 39 private void localVariables() 40 { 41 // normal decl 42 int abc = 0; 43 int ABC = 0; 44 45 // final decls 46 final int cde = 0; 47 final int CDE = 0; 48 49 // decl in for loop init statement 50 for (int k = 0; k < 1; k++) 51 { 52 String innerBlockVariable = ""; 53 } 54 for (int I = 0; I < 1; I++) 55 { 56 String InnerBlockVariable = ""; 57 } 58 } 59 60 /** test method pattern */ 61 void ALL_UPPERCASE_METHOD() // violation 'Name 'ALL_UPPERCASE_METHOD' must match pattern' 62 { 63 } 64 65 /** test illegal constant **/ 66 private static final int BAD__NAME = 3; 67 68 // A very, very long line that is OK because it matches the regexp "^.*is OK.*regexp.*$" 69 // long line that has a tab -> <- and would be OK if tab counted as 1 char 70 // tabs that count as one char because of their position -> <- -> <-, OK 71 72 /** some lines to test the violation column after tabs */ 73 void errorColumnAfterTabs() 74 { 75 // with tab-width 8 all statements below start at the same column, 76 // with different combinations of ' ' and '\t' before the statement 77 int tab0 =1; 78 int tab1 =1; 79 int tab2 =1; 80 int tab3 =1; 81 int tab4 =1; 82 int tab5 =1; 83 } 84 85 // MEMME: 86 /* MEMME: a 87 * MEMME: 88 * OOOO 89 */ 90 /* NOTHING */ 91 /* YES */ /* MEMME: x */ /* YES!! */ 92 93 }