Buggy code:
public class ForeachStatement extends Statement { public LocalDeclaration elementVariable ; public int elementVariableImplicitWidening = - 1 ; public Expression collection ; public Statement action ; private int kind ; private static final int ARRAY = 0 ; private static final int RAW_ITERABLE = 1 ; private static final int GENERIC_ITERABLE = 2 ; private TypeBinding collectionElementType ; private Label breakLabel ; private Label continueLabel ; public BlockScope scope ; public LocalVariableBinding indexVariable ; public LocalVariableBinding collectionVariable ; public LocalVariableBinding maxVariable ; private static final char [ ] SecretIndexVariableName = "<seq2seq4repair_space>index" . toCharArray ( ) ; private static final char [ ] SecretCollectionVariableName = "<seq2seq4repair_space>collection" . toCharArray ( ) ; private static final char [ ] SecretMaxVariableName = "<seq2seq4repair_space>max" . toCharArray ( ) ; int postCollectionInitStateIndex = - 1 ; int mergedInitStateIndex = - 1 ; public ForeachStatement ( LocalDeclaration elementVariable , Expression collection , int start ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( ( bits ) & ( IsReachableMASK ) ) == 0 ) { return ; } int pc = codeStream . position ; if ( ( ( ( this . action ) == null ) || ( this . action . isEmptyBlock ( ) ) ) || ( ( ( this . action . bits ) & ( IsUsefulEmptyStatementMASK ) ) != 0 ) ) { codeStream . exitUserScope ( scope ) ; if ( ( mergedInitStateIndex ) != ( - 1 ) ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , mergedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , mergedInitStateIndex ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } switch ( this . kind ) { case ForeachStatement . ARRAY : collection . generateCode ( scope , codeStream , true ) ; codeStream . store ( this . collectionVariable , false ) ; codeStream . iconst_0 ( ) ; codeStream . store ( this . indexVariable , false ) ; codeStream . load ( this . collectionVariable ) ; codeStream . arraylength ( ) ; codeStream . store ( this . maxVariable , false ) ; break ; case ForeachStatement . RAW_ITERABLE : case ForeachStatement . GENERIC_ITERABLE : collection . generateCode ( scope , codeStream , true ) ; <START_BUG> final TypeBinding collectionTypeBinding = collection . resolvedType ; <END_BUG> MethodBinding iteratorMethodBinding = new MethodBinding ( AccPublic , "iterator" . toCharArray ( ) , scope . getJavaUtilIterator ( ) , NoParameters , NoExceptions , ( ( ReferenceBinding ) ( collectionTypeBinding ) ) ) ; if ( collectionTypeBinding . isInterface ( ) ) { codeStream . invokeinterface ( iteratorMethodBinding ) ; } else { codeStream . invokevirtual ( iteratorMethodBinding ) ; } codeStream . store ( this . indexVariable , false ) ; break ; } Label actionLabel = new Label ( codeStream ) ; Label conditionLabel = new Label ( codeStream ) ; breakLabel . initialize ( codeStream ) ; if ( ( this . continueLabel ) != null ) { this . continueLabel . initialize ( codeStream ) ; } codeStream . goto_ ( conditionLabel ) ; actionLabel . place ( ) ; if ( ( this . elementVariable . binding . resolvedPosition ) != ( - 1 ) ) { switch ( this . kind ) { case ForeachStatement . ARRAY : codeStream . load ( this . collectionVariable ) ; codeStream . load ( this . indexVariable ) ; codeStream . arrayAt ( this . collectionElementType . id ) ; if ( ( this . elementVariableImplicitWidening ) != ( - 1 ) ) { codeStream . generateImplicitConversion ( this . elementVariableImplicitWidening ) ; } codeStream . store ( this . elementVariable . binding , false ) ; break ; case ForeachStatement . RAW_ITERABLE : case ForeachStatement . GENERIC_ITERABLE : codeStream . load ( this . indexVariable ) ; codeStream . invokeJavaUtilIteratorNext ( ) ; if ( ( this . elementVariable . binding . type . id ) != ( TypeIds . T_JavaLangObject ) ) { if ( ( this . elementVariableImplicitWidening ) != ( - 1 ) ) { codeStream . checkcast ( this . collectionElementType ) ; codeStream . generateImplicitConversion ( this . elementVariableImplicitWidening ) ; } else { codeStream . checkcast ( this . elementVariable . binding . type ) ; } } codeStream . store ( this . elementVariable . binding , false ) ; break ; } codeStream . addVisibleLocalVariable ( this . elementVariable . binding ) ; if ( ( this . postCollectionInitStateIndex ) != ( - 1 ) ) { codeStream . addDefinitelyAssignedVariables ( currentScope , this . postCollectionInitStateIndex ) ; } } else { switch ( this . kind ) { case ForeachStatement . ARRAY : break ; case ForeachStatement . RAW_ITERABLE : case ForeachStatement . GENERIC_ITERABLE : codeStream . load ( this . indexVariable ) ; codeStream . invokeJavaUtilIteratorNext ( ) ; codeStream . pop ( ) ; break ; } } this . action . generateCode ( scope , codeStream ) ; int continuationPC = codeStream . position ; if ( ( this . continueLabel ) != null ) { this . continueLabel . place ( ) ; switch ( this . kind ) { case ForeachStatement . ARRAY : codeStream . iinc ( this . indexVariable . resolvedPosition , 1 ) ; break ; case ForeachStatement . RAW_ITERABLE : case ForeachStatement . GENERIC_ITERABLE : break ; } } conditionLabel . place ( ) ; if ( ( this . postCollectionInitStateIndex ) != ( - 1 ) ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , postCollectionInitStateIndex ) ; } switch ( this . kind ) { case ForeachStatement . ARRAY : codeStream . load ( this . indexVariable ) ; codeStream . load ( this . maxVariable ) ; codeStream . if_icmplt ( actionLabel ) ; break ;

Fix:
final TypeBinding collectionTypeBinding = collection . resolvedType . erasure ( ) ;