Buggy code:
public final class SelectionEngine extends Engine implements ISearchRequestor { public static boolean DEBUG = false ; public static boolean PERF = false ; SelectionParser parser ; ISelectionRequestor requestor ; boolean acceptedAnswer ; private int actualSelectionStart ; private int actualSelectionEnd ; private char [ ] selectedIdentifier ; private char [ ] [ ] [ ] acceptedClasses ; private int [ ] acceptedClassesModifiers ; private char [ ] [ ] [ ] acceptedInterfaces ; private int [ ] acceptedInterfacesModifiers ; private char [ ] [ ] [ ] acceptedEnums ; private int [ ] acceptedEnumsModifiers ; private char [ ] [ ] [ ] acceptedAnnotations ; private int [ ] acceptedAnnotationsModifiers ; int acceptedClassesCount ; int acceptedInterfacesCount ; int acceptedEnumsCount ; int acceptedAnnotationsCount ; boolean noProposal = true ; IProblem problem = null ; public SelectionEngine ( SearchableEnvironment nameEnvironment , ISelectionRequestor requestor , Map settings ) { } public void acceptType ( char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , int modifiers , AccessRestriction accessRestriction ) { } public void acceptPackage ( char [ ] packageName ) { } private void acceptQualifiedTypes ( ) { } private boolean checkSelection ( char [ ] source , int selectionStart , int selectionEnd ) { } private boolean checkTypeArgument ( Scanner scanner ) throws InvalidInputException { } public AssistParser getParser ( ) { } private boolean isLocal ( ReferenceBinding binding ) { } public void select ( ICompilationUnit sourceUnit , int selectionSourceStart , int selectionSourceEnd ) { } private void selectMemberTypeFromImport ( CompilationUnitDeclaration parsedUnit , char [ ] lastToken , ReferenceBinding ref , boolean staticOnly ) { } private void selectStaticFieldFromStaticImport ( CompilationUnitDeclaration parsedUnit , char [ ] lastToken , ReferenceBinding ref ) { } private void selectStaticMethodFromStaticImport ( CompilationUnitDeclaration parsedUnit , char [ ] lastToken , ReferenceBinding ref ) { } private void selectFrom ( Binding binding , CompilationUnitDeclaration parsedUnit , boolean isDeclaration ) { if ( binding instanceof TypeVariableBinding ) { TypeVariableBinding typeVariableBinding = ( ( TypeVariableBinding ) ( binding ) ) ; Binding enclosingElement = typeVariableBinding . declaringElement ; this . noProposal = false ; if ( enclosingElement instanceof SourceTypeBinding ) { SourceTypeBinding enclosingType = ( ( SourceTypeBinding ) ( enclosingElement ) ) ; this . requestor . acceptTypeParameter ( enclosingType . qualifiedPackageName ( ) , enclosingType . qualifiedSourceName ( ) , typeVariableBinding . sourceName ( ) , false , this . actualSelectionStart , this . actualSelectionEnd ) ; } else if ( enclosingElement instanceof MethodBinding ) { MethodBinding enclosingMethod = ( ( MethodBinding ) ( enclosingElement ) ) ; this . requestor . acceptMethodTypeParameter ( enclosingMethod . declaringClass . qualifiedPackageName ( ) , enclosingMethod . declaringClass . qualifiedSourceName ( ) , ( enclosingMethod . isConstructor ( ) ? enclosingMethod . declaringClass . sourceName ( ) : enclosingMethod . selector ) , enclosingMethod . sourceStart ( ) , enclosingMethod . sourceEnd ( ) , typeVariableBinding . sourceName ( ) , false , this . actualSelectionStart , this . actualSelectionEnd ) ; } this . acceptedAnswer = true ; } else if ( binding instanceof ReferenceBinding ) { ReferenceBinding typeBinding = ( ( ReferenceBinding ) ( binding ) ) ; if ( typeBinding instanceof ProblemReferenceBinding ) { <START_BUG> typeBinding = ( ( ProblemReferenceBinding ) ( typeBinding ) ) . original ; <END_BUG> } if ( typeBinding == null ) return ; if ( ( isLocal ( typeBinding ) ) && ( ( this . requestor ) instanceof SelectionRequestor ) ) { this . noProposal = false ; ( ( SelectionRequestor ) ( this . requestor ) ) . acceptLocalType ( typeBinding ) ; } else { this . noProposal = false ; this . requestor . acceptType ( typeBinding . qualifiedPackageName ( ) , typeBinding . qualifiedSourceName ( ) , typeBinding . modifiers , false , typeBinding . computeUniqueKey ( ) , this . actualSelectionStart , this . actualSelectionEnd ) ; } this . acceptedAnswer = true ; } else if ( binding instanceof MethodBinding ) { MethodBinding methodBinding = ( ( MethodBinding ) ( binding ) ) ; TypeBinding [ ] parameterTypes = methodBinding . original ( ) . parameters ; int length = parameterTypes . length ; char [ ] [ ] parameterPackageNames = new char [ length ] [ ] ; char [ ] [ ] parameterTypeNames = new char [ length ] [ ] ; String [ ] parameterSignatures = new String [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { parameterPackageNames [ i ] = parameterTypes [ i ] . qualifiedPackageName ( ) ; parameterTypeNames [ i ] = parameterTypes [ i ] . qualifiedSourceName ( ) ; parameterSignatures [ i ] = new String ( Engine . getSignature ( parameterTypes [ i ] ) ) . replace ( '//' , '.' ) ; } this . noProposal = false ; ReferenceBinding declaringClass = methodBinding . declaringClass ; if ( ( isLocal ( declaringClass ) ) && ( ( this . requestor ) instanceof SelectionRequestor ) ) { ( ( SelectionRequestor ) ( this . requestor ) ) . acceptLocalMethod ( methodBinding ) ; } else { this . requestor . acceptMethod ( declaringClass . qualifiedPackageName ( ) , declaringClass . qualifiedSourceName ( ) , ( ( declaringClass . enclosingType ( ) ) == null ? null : new String ( Engine . getSignature ( declaringClass . enclosingType ( ) ) ) ) , ( methodBinding . isConstructor ( ) ? declaringClass . sourceName ( ) : methodBinding . selector ) , parameterPackageNames , parameterTypeNames , parameterSignatures , methodBinding . isConstructor ( ) , isDeclaration , methodBinding . computeUniqueKey ( ) , this . actualSelectionStart , this . actualSelectionEnd ) ; } this . acceptedAnswer = true ; } else if ( binding instanceof FieldBinding ) { FieldBinding fieldBinding = ( ( FieldBinding ) ( binding ) ) ; ReferenceBinding declaringClass = fieldBinding . declaringClass ; if ( declaringClass != null ) { this . noProposal = false ;

Fix:
typeBinding = ( ( ProblemReferenceBinding ) ( typeBinding ) ) . closestMatch ;