Buggy code:
} else if ( binding instanceof TypeBinding ) { return this . getTypeBinding ( ( ( TypeBinding ) ( binding ) ) ) ; } else { return null ; } } } } else if ( node instanceof ImportReference ) { ImportReference importReference = ( ( ImportReference ) ( node ) ) ; int importReferenceLength = importReference . tokens . length ; int indexInImportReference = importReferenceLength - index ; if ( indexInImportReference >= 0 ) { Binding binding = this . scope . getTypeOrPackage ( CharOperation . subarray ( importReference . tokens , 0 , indexInImportReference ) ) ; if ( binding != null ) { if ( binding instanceof PackageBinding ) { return this . getPackageBinding ( ( ( PackageBinding ) ( binding ) ) ) ; } else if ( binding instanceof TypeBinding ) { return this . getTypeBinding ( ( ( TypeBinding ) ( binding ) ) ) ; } else { return null ; } } } } else if ( node instanceof CompilationUnitDeclaration ) { CompilationUnitDeclaration compilationUnitDeclaration = ( ( CompilationUnitDeclaration ) ( node ) ) ; TypeDeclaration [ ] types = compilationUnitDeclaration . types ; if ( ( types == null ) || ( ( types . length ) == 0 ) ) { return null ; } TypeDeclaration type = types [ 0 ] ; if ( type != null ) { ITypeBinding typeBinding = this . getTypeBinding ( type . binding ) ; if ( typeBinding != null ) { return typeBinding . getPackage ( ) ; } } } else if ( node instanceof AbstractMethodDeclaration ) { AbstractMethodDeclaration methodDeclaration = ( ( AbstractMethodDeclaration ) ( node ) ) ; if ( methodDeclaration != null ) { IMethodBinding methodBinding = this . getMethodBinding ( methodDeclaration . binding ) ; if ( methodBinding != null ) { return methodBinding ; } } } else if ( node instanceof TypeDeclaration ) { TypeDeclaration typeDeclaration = ( ( TypeDeclaration ) ( node ) ) ; ITypeBinding typeBinding = this . getTypeBinding ( typeDeclaration . binding ) ; if ( typeBinding != null ) { return typeBinding ; } } if ( node instanceof SingleNameReference ) { SingleNameReference singleNameReference = ( ( SingleNameReference ) ( node ) ) ; if ( singleNameReference . isTypeReference ( ) ) { return this . getTypeBinding ( ( ( ReferenceBinding ) ( singleNameReference . binding ) ) ) ; } else { Binding binding = singleNameReference . binding ; if ( binding != null ) { if ( binding . isValidBinding ( ) ) { return this . getVariableBinding ( ( ( VariableBinding ) ( binding ) ) ) ; } else { if ( binding instanceof ProblemFieldBinding ) { ProblemFieldBinding problemFieldBinding = ( ( ProblemFieldBinding ) ( binding ) ) ; switch ( problemFieldBinding . problemId ( ) ) { case ProblemReasons . NotVisible : case ProblemReasons . NonStaticReferenceInStaticContext : case ProblemReasons . NonStaticReferenceInConstructorInvocation : ReferenceBinding declaringClass = problemFieldBinding . declaringClass ; FieldBinding exactBinding = declaringClass . getField ( problemFieldBinding . name ) ; if ( exactBinding != null ) { IVariableBinding variableBinding2 = ( ( IVariableBinding ) ( this . compilerBindingsToASTBindings . get ( exactBinding ) ) ) ; if ( variableBinding2 != null ) { return variableBinding2 ; } variableBinding2 = new VariableBinding ( this , exactBinding ) ; this . compilerBindingsToASTBindings . put ( exactBinding , variableBinding2 ) ; return variableBinding2 ; } break ; } } } } } } else if ( node instanceof QualifiedSuperReference ) { QualifiedSuperReference qualifiedSuperReference = ( ( QualifiedSuperReference ) ( node ) ) ; return this . getTypeBinding ( qualifiedSuperReference . qualification . resolvedType ) ; } else if ( node instanceof LocalDeclaration ) { return this . getVariableBinding ( ( ( LocalDeclaration ) ( node ) ) . binding ) ; } else if ( node instanceof FieldReference ) { return getVariableBinding ( ( ( FieldReference ) ( node ) ) . binding ) ; } else if ( node instanceof SingleTypeReference ) { SingleTypeReference singleTypeReference = ( ( SingleTypeReference ) ( node ) ) ; TypeBinding binding = singleTypeReference . resolvedType ; <START_BUG> if ( ( binding != null ) && ( binding instanceof TypeBinding ) ) { <END_BUG> return this . getTypeBinding ( binding . leafComponentType ( ) ) ; } } else if ( node instanceof FieldDeclaration ) { FieldDeclaration fieldDeclaration = ( ( FieldDeclaration ) ( node ) ) ; return this . getVariableBinding ( fieldDeclaration . binding ) ; } else if ( node instanceof MessageSend ) { MessageSend messageSend = ( ( MessageSend ) ( node ) ) ; return getMethodBinding ( messageSend . binding ) ; } return null ; } ITypeBinding resolveType ( Type type ) { } ITypeBinding resolveWellKnownType ( String name ) { } ITypeBinding resolveType ( TypeDeclaration type ) { } IMethodBinding resolveMethod ( MethodDeclaration method ) { } IMethodBinding resolveMethod ( MethodInvocation method ) { } IMethodBinding resolveMethod ( SuperMethodInvocation method ) { } IVariableBinding resolveVariable ( VariableDeclaration variable ) { } IVariableBinding resolveVariable ( FieldDeclaration variable ) { } ITypeBinding resolveExpressionType ( Expression expression ) { } IVariableBinding resolveField ( FieldAccess fieldAccess ) { } IVariableBinding resolveField ( SuperFieldAccess fieldAccess ) { } IBinding resolveImport ( ImportDeclaration importDeclaration ) { } IPackageBinding resolvePackage ( PackageDeclaration pkg ) { } public ASTNode findDeclaringNode ( IBinding binding ) { } ASTNode findDeclaringNode ( String bindingKey ) { } void store ( ASTNode node , AstNode oldASTNode ) { } void updateKey ( ASTNode node , ASTNode newNode ) { } protected ITypeBinding getTypeBinding ( TypeBinding referenceBinding ) { } protected IPackageBinding getPackageBinding ( PackageBinding packageBinding ) { } protected IVariableBinding getVariableBinding ( VariableBinding variableBinding ) { } protected IMethodBinding getMethodBinding ( MethodBinding methodBinding ) { } IMethodBinding resolveConstructor ( ClassInstanceCreation expression ) { } IMethodBinding resolveConstructor ( ConstructorInvocation expression ) { } IMethodBinding resolveConstructor ( SuperConstructorInvocation expression ) { } ITypeBinding resolveType ( AnonymousClassDeclaration type ) { } AstNode getCorrespondingNode ( ASTNode currentNode ) { }

Fix:
if ( binding != null ) {