Buggy code:
} ; public static final String ALL = "ALL" ; private static final String DOUBLE_QUOTE = "\"" ; private static final String HASH_INCLUDE = "#include" ; private static final Map < NameType , Map < RuleType , Map < String , Map < String , List < Rule > > > > > RULES = new EnumMap < NameType , Map < RuleType , Map < String , Map < String , List < Rule > > > > > ( NameType . class ) ; private static boolean contains ( final CharSequence chars , final char input ) { } private static String createResourceName ( final NameType nameType , final RuleType rt , final String lang ) { } private static Scanner createScanner ( final NameType nameType , final RuleType rt , final String lang ) { } private static Scanner createScanner ( final String lang ) { } private static boolean endsWith ( final CharSequence input , final CharSequence suffix ) { } public static Map < String , List < Rule > > getInstance ( final NameType nameType , final RuleType rt , final Languages . LanguageSet langs ) { } public static Map < String , List < Rule > > getInstance ( final NameType nameType , final RuleType rt , final String lang ) { } private static Rule . Phoneme parsePhoneme ( final String ph ) { } private static Rule . PhonemeExpr parsePhonemeExpr ( final String ph ) { } private static Map < String , List < Rule > > parseRules ( final Scanner scanner , final String location ) { final Map < String , List < Rule > > lines = new HashMap < String , List < Rule > > ( ) ; int currentLine = 0 ; boolean inMultilineComment = false ; while ( scanner . hasNextLine ( ) ) { currentLine ++ ; final String rawLine = scanner . nextLine ( ) ; String line = rawLine ; if ( inMultilineComment ) { if ( line . endsWith ( ResourceConstants . EXT_CMT_END ) ) { inMultilineComment = false ; } } else { if ( line . startsWith ( ResourceConstants . EXT_CMT_START ) ) { inMultilineComment = true ; } else { final int cmtI = line . indexOf ( ResourceConstants . CMT ) ; if ( cmtI >= 0 ) { line = line . substring ( 0 , cmtI ) ; } line = line . trim ( ) ; if ( ( line . length ( ) ) == 0 ) { continue ; } if ( line . startsWith ( Rule . HASH_INCLUDE ) ) { final String incl = line . substring ( Rule . HASH_INCLUDE . length ( ) ) . trim ( ) ; if ( incl . contains ( "<seq2seq4repair_space>" ) ) { throw new IllegalArgumentException ( ( ( ( "Malformed<seq2seq4repair_space>import<seq2seq4repair_space>statement<seq2seq4repair_space>'" + rawLine ) + "'<seq2seq4repair_space>in<seq2seq4repair_space>" ) + location ) ) ; } else { lines . putAll ( Rule . parseRules ( Rule . createScanner ( incl ) , ( ( location + "->" ) + incl ) ) ) ; } } else { final String [ ] parts = line . split ( "\\s+" ) ; if ( ( parts . length ) != 4 ) { throw new IllegalArgumentException ( ( ( ( ( ( "Malformed<seq2seq4repair_space>rule<seq2seq4repair_space>statement<seq2seq4repair_space>split<seq2seq4repair_space>into<seq2seq4repair_space>" + ( parts . length ) ) + "<seq2seq4repair_space>parts:<seq2seq4repair_space>" ) + rawLine ) + "<seq2seq4repair_space>in<seq2seq4repair_space>" ) + location ) ) ; } else { try { final String pat = Rule . stripQuotes ( parts [ 0 ] ) ; final String lCon = Rule . stripQuotes ( parts [ 1 ] ) ; final String rCon = Rule . stripQuotes ( parts [ 2 ] ) ; final Rule . PhonemeExpr ph = Rule . parsePhonemeExpr ( Rule . stripQuotes ( parts [ 3 ] ) ) ; final int cLine = currentLine ; final Rule r = new Rule ( pat , lCon , rCon , ph ) { private final int myLine = cLine ; private final String loc = location ; @ Override public String toString ( ) { final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "Rule" ) ; sb . append ( "{line=" ) . append ( myLine ) ; sb . append ( ",<seq2seq4repair_space>loc='" ) . append ( loc ) . append ( '\'' ) ; sb . append ( '}' ) ; return sb . toString ( ) ; } } ; <START_BUG> String patternKey = r . pattern . substring ( 0 , 1 ) ; <END_BUG> List < Rule > rules = lines . get ( patternKey ) ; if ( rules == null ) { rules = new ArrayList < Rule > ( ) ; lines . put ( patternKey , rules ) ; } rules . add ( r ) ; } catch ( final IllegalArgumentException e ) { throw new IllegalStateException ( ( ( ( "Problem<seq2seq4repair_space>parsing<seq2seq4repair_space>line<seq2seq4repair_space>'" + currentLine ) + "'<seq2seq4repair_space>in<seq2seq4repair_space>" ) + location ) , e ) ; } } } } } } return lines ; } private static Rule . RPattern pattern ( final String regex ) { } private static boolean startsWith ( final CharSequence input , final CharSequence prefix ) { } private static String stripQuotes ( String str ) { } private final Rule . RPattern lContext ; private final String pattern ; private final Rule . PhonemeExpr phoneme ; private final Rule . RPattern rContext ; public Rule ( final String pattern , final String lContext , final String rContext , final Rule . PhonemeExpr phoneme ) { } public Rule . RPattern getLContext ( ) { } public String getPattern ( ) { } public Rule . PhonemeExpr getPhoneme ( ) { } public Rule . RPattern getRContext ( ) { } public boolean patternAndContextMatches ( final CharSequence input , final int i ) { } }

Fix:
final String patternKey = r . pattern . substring ( 0 , 1 ) ;