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 int arrayElementTypeID ; 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 ) { } public StringBuffer printStatement ( int tab , StringBuffer output ) { } public void resolve ( BlockScope upperScope ) { scope = new BlockScope ( upperScope ) ; this . elementVariable . resolve ( scope ) ; TypeBinding elementType = this . elementVariable . type . resolvedType ; TypeBinding collectionType = this . collection . resolveType ( scope ) ; this . collection . computeConversion ( scope , collectionType , collectionType ) ; boolean hasError = ( elementType == null ) || ( collectionType == null ) ; if ( ! hasError ) { if ( collectionType . isArrayType ( ) ) { this . kind = ForeachStatement . ARRAY ; TypeBinding collectionElementType = ( ( ArrayBinding ) ( collectionType ) ) . elementsType ( ) ; if ( ! ( collectionElementType . isCompatibleWith ( elementType ) ) ) { scope . problemReporter ( ) . notCompatibleTypesErrorInForeach ( collection , collectionElementType , elementType ) ; } this . arrayElementTypeID = collectionElementType . id ; if ( elementType . isBaseType ( ) ) { this . elementVariableImplicitWidening = ( ( elementType . id ) << 4 ) + ( this . arrayElementTypeID ) ; } } else if ( collectionType instanceof ReferenceBinding ) { <START_BUG> ReferenceBinding iterableType = ( ( ReferenceBinding ) ( collectionType ) ) . findSuperTypeErasingTo ( scope . getJavaLangIterable ( ) ) ; <END_BUG> if ( iterableType != null ) { if ( iterableType . isParameterizedType ( ) ) { ParameterizedTypeBinding parameterizedType = ( ( ParameterizedTypeBinding ) ( iterableType ) ) ; if ( ( parameterizedType . arguments . length ) == 1 ) { this . kind = ForeachStatement . GENERIC_ITERABLE ; TypeBinding collectionElementType = parameterizedType . arguments [ 0 ] ; if ( ! ( collectionElementType . isCompatibleWith ( elementType ) ) ) { scope . problemReporter ( ) . notCompatibleTypesErrorInForeach ( collection , collectionElementType , elementType ) ; } } } else if ( iterableType . isGenericType ( ) ) { if ( ( iterableType . typeVariables ( ) . length ) == 1 ) { this . kind = ForeachStatement . GENERIC_ITERABLE ; TypeBinding collectionElementType = iterableType . typeVariables ( ) [ 0 ] ; if ( ! ( collectionElementType . isCompatibleWith ( elementType ) ) ) { scope . problemReporter ( ) . notCompatibleTypesErrorInForeach ( collection , collectionElementType , elementType ) ; } } } else if ( iterableType . isRawType ( ) ) { this . kind = ForeachStatement . RAW_ITERABLE ; TypeBinding collectionElementType = scope . getJavaLangObject ( ) ; if ( ! ( collectionElementType . isCompatibleWith ( elementType ) ) ) { scope . problemReporter ( ) . notCompatibleTypesErrorInForeach ( collection , collectionElementType , elementType ) ; } } } } switch ( this . kind ) { case ForeachStatement . ARRAY : this . indexVariable = new LocalVariableBinding ( ForeachStatement . SecretIndexVariableName , IntBinding , AccDefault , false ) ; scope . addLocalVariable ( this . indexVariable ) ; this . indexVariable . setConstant ( NotAConstant ) ; this . maxVariable = new LocalVariableBinding ( ForeachStatement . SecretMaxVariableName , IntBinding , AccDefault , false ) ; scope . addLocalVariable ( this . maxVariable ) ; this . maxVariable . setConstant ( NotAConstant ) ; this . collectionVariable = new LocalVariableBinding ( ForeachStatement . SecretCollectionVariableName , collectionType , AccDefault , false ) ; scope . addLocalVariable ( this . collectionVariable ) ; this . collectionVariable . setConstant ( NotAConstant ) ; break ; case ForeachStatement . RAW_ITERABLE : case ForeachStatement . GENERIC_ITERABLE : this . indexVariable = new LocalVariableBinding ( ForeachStatement . SecretIndexVariableName , scope . getJavaUtilIterator ( ) , AccDefault , false ) ; scope . addLocalVariable ( this . indexVariable ) ; this . indexVariable . setConstant ( NotAConstant ) ; break ; default : scope . problemReporter ( ) . invalidTypeForCollection ( collection ) ; } } if ( ( action ) != null ) { action . resolve ( scope ) ; } } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { } }

Fix:
ReferenceBinding iterableType = ( ( ReferenceBinding ) ( collectionType ) ) . findSuperTypeErasingTo ( TypeIds . T_JavaLangIterable , false ) ;