Buggy code:
private final List < String > includes = new ArrayList < > ( ) ; private final List < String > codes = new ArrayList < > ( ) ; private final Map < String , SymbolNonTerm > index = new HashMap < > ( ) ; private final List < SymbolNonTerm > exports = new ArrayList < > ( ) ; private final List < SymbolNonTerm > symbols = new ArrayList < > ( ) ; public Grammar ( Reader reader ) throws IOException , SyntaxException { } public String getNamespace ( ) { } public String getParser ( ) { } public void setParser ( String parser ) { } public String getCharacter ( ) { } public void setCharacter ( String character ) { } public List < String > getIncludes ( ) { } public List < String > getCodes ( ) { } public List < SymbolNonTerm > getExports ( ) { } public List < SymbolNonTerm > getSymbols ( ) { } private static List < String > tokenize ( Reader reader ) throws IOException , SyntaxException { } private void parse ( List < String > tokens ) throws SyntaxException { int pos = 0 ; boolean exp = false ; while ( pos < ( tokens . size ( ) ) ) { String token = tokens . get ( pos ) ; if ( token . equals ( "<export>" ) ) { exp = true ; } else if ( ( token . startsWith ( "<include:" ) ) && ( ( token . charAt ( ( ( token . length ( ) ) - 1 ) ) ) == '>' ) ) { includes . add ( token . substring ( 9 , ( ( token . length ( ) ) - 1 ) ) ) ; } else if ( ( token . startsWith ( "<namespace:" ) ) && ( ( token . charAt ( ( ( token . length ( ) ) - 1 ) ) ) == '>' ) ) { namespace = token . substring ( 11 , ( ( token . length ( ) ) - 1 ) ) ; } else if ( ( token . startsWith ( "<class:" ) ) && ( ( token . charAt ( ( ( token . length ( ) ) - 1 ) ) ) == '>' ) ) { parser = token . substring ( 7 , ( ( token . length ( ) ) - 1 ) ) ; } else if ( ( ( ( token . length ( ) ) > 2 ) && ( ( token . charAt ( 0 ) ) == '{' ) ) && ( ( token . charAt ( ( ( token . length ( ) ) - 1 ) ) ) == '}' ) ) { codes . add ( token . substring ( 1 , ( ( token . length ( ) ) - 1 ) ) ) ; } else { SymbolNonTerm symbol = getSymbol ( token ) ; symbols . add ( symbol ) ; if ( exp ) { exports . add ( symbol ) ; exp = false ; } pos ++ ; if ( tokens . get ( pos ) . equals ( ":" ) ) { symbol . setType ( tokens . get ( ( pos + 1 ) ) ) ; pos += 2 ; } if ( ! ( tokens . get ( pos ) . equals ( "=" ) ) ) { throw new SyntaxException ( ( ( ( ( symbol . getName ( ) ) + ":<seq2seq4repair_space>Unexptected<seq2seq4repair_space>token<seq2seq4repair_space>'" ) + ( tokens . get ( pos ) ) ) + "'.<seq2seq4repair_space>Exptected:<seq2seq4repair_space>'='." ) ) ; } do { token = tokens . get ( ( ++ pos ) ) ; List < Symbol > rule = new ArrayList < > ( ) ; symbol . addRule ( rule ) ; while ( ( ! ( token . equals ( "|" ) ) ) && ( ! ( token . equals ( ";" ) ) ) ) { if ( ( ( ( token . length ( ) ) >= 2 ) && ( ( token . charAt ( 0 ) ) == '\'' ) ) && ( ( token . charAt ( ( ( token . length ( ) ) - 1 ) ) ) == '\'' ) ) { rule . add ( new SymbolTerm ( token ) ) ; } else if ( ( ( ( token . length ( ) ) > 2 ) && ( ( token . charAt ( 0 ) ) == '{' ) ) && ( ( token . charAt ( ( ( token . length ( ) ) - 1 ) ) ) == '}' ) ) { rule . add ( new SymbolCode ( token ) ) ; } else if ( ( ( ( token . length ( ) ) > 2 ) && ( ( token . charAt ( 0 ) ) == '<' ) ) && ( ( token . charAt ( ( ( token . length ( ) ) - 1 ) ) ) == '>' ) ) { rule . add ( new SymbolInstr ( token ) ) ; } else { rule . add ( getSymbol ( token ) ) ; } token = tokens . get ( ( ++ pos ) ) ; } } while ( ! ( token . equals ( ";" ) ) ) ; } pos ++ ; } <START_BUG> for ( SymbolNonTerm symbol : symbols ) { <END_BUG> if ( ( symbol . getRules ( ) . size ( ) ) == 0 ) { throw new SyntaxException ( ( ( symbol . getName ( ) ) + ":<seq2seq4repair_space>Symbol<seq2seq4repair_space>is<seq2seq4repair_space>used<seq2seq4repair_space>but<seq2seq4repair_space>not<seq2seq4repair_space>defined." ) ) ; } } } private SymbolNonTerm getSymbol ( String token ) throws SyntaxException { } private boolean isIdent ( String token ) { } }

Fix:
for ( SymbolNonTerm symbol : index . values ( ) ) {