Buggy code:
class DefaultBindingResolver extends BindingResolver { static class BindingTables { Map bindingKeysToBindings ; Map compilerBindingsToASTBindings ; BindingTables ( ) { } } Map astNodesToBlockScope ; Map bindingsToAstNodes ; DefaultBindingResolver . BindingTables bindingTables ; Map newAstToOldAst ; private CompilationUnitScope scope ; WorkingCopyOwner workingCopyOwner ; boolean isRecoveringBindings ; boolean fromJavaProject ; DefaultBindingResolver ( CompilationUnitScope scope , WorkingCopyOwner workingCopyOwner , DefaultBindingResolver . BindingTables bindingTables , boolean isRecoveringBindings , boolean fromJavaProject ) { } DefaultBindingResolver ( LookupEnvironment lookupEnvironment , WorkingCopyOwner workingCopyOwner , DefaultBindingResolver . BindingTables bindingTables , boolean isRecoveringBindings , boolean fromJavaProject ) { } synchronized ASTNode findDeclaringNode ( IBinding binding ) { } synchronized ASTNode findDeclaringNode ( String bindingKey ) { } IBinding getBinding ( Binding binding ) { } Util . BindingsToNodesMap getBindingsToNodesMap ( ) { } synchronized org . eclipse . jdt . internal . compiler . ast . ASTNode getCorrespondingNode ( ASTNode currentNode ) { } synchronized IMethodBinding getMethodBinding ( MethodBinding methodBinding ) { } synchronized IMemberValuePairBinding getMemberValuePairBinding ( ElementValuePair valuePair ) { } synchronized IPackageBinding getPackageBinding ( PackageBinding packageBinding ) { } private int getTypeArguments ( ParameterizedQualifiedTypeReference typeReference ) { } synchronized ITypeBinding getTypeBinding ( VariableDeclaration variableDeclaration ) { } synchronized ITypeBinding getTypeBinding ( Type type ) { } synchronized ITypeBinding getTypeBinding ( TypeBinding referenceBinding ) { } synchronized ITypeBinding getTypeBinding ( RecoveredTypeBinding recoveredTypeBinding , int dimensions ) { } synchronized IVariableBinding getVariableBinding ( VariableBinding variableBinding , VariableDeclaration variableDeclaration ) { } public WorkingCopyOwner getWorkingCopyOwner ( ) { } synchronized IVariableBinding getVariableBinding ( VariableBinding variableBinding ) { } synchronized IAnnotationBinding getAnnotationInstance ( AnnotationBinding internalInstance ) { } boolean isResolvedTypeInferredFromExpectedType ( MethodInvocation methodInvocation ) { } boolean isResolvedTypeInferredFromExpectedType ( SuperMethodInvocation superMethodInvocation ) { } boolean isResolvedTypeInferredFromExpectedType ( ClassInstanceCreation classInstanceCreation ) { } LookupEnvironment lookupEnvironment ( ) { } synchronized void recordScope ( ASTNode astNode , BlockScope blockScope ) { } boolean resolveBoxing ( Expression expression ) { } boolean resolveUnboxing ( Expression expression ) { } Object resolveConstantExpressionValue ( Expression expression ) { } synchronized IMethodBinding resolveConstructor ( ClassInstanceCreation expression ) { } synchronized IMethodBinding resolveConstructor ( ConstructorInvocation expression ) { } IMethodBinding resolveConstructor ( EnumConstantDeclaration enumConstantDeclaration ) { } synchronized IMethodBinding resolveConstructor ( SuperConstructorInvocation expression ) { } synchronized ITypeBinding resolveExpressionType ( Expression expression ) { } synchronized IVariableBinding resolveField ( FieldAccess fieldAccess ) { } synchronized IVariableBinding resolveField ( SuperFieldAccess fieldAccess ) { } synchronized IBinding resolveImport ( ImportDeclaration importDeclaration ) { } IMethodBinding resolveMember ( AnnotationTypeMemberDeclaration declaration ) { } synchronized IMethodBinding resolveMethod ( MethodDeclaration method ) { } synchronized IMethodBinding resolveMethod ( MethodInvocation method ) { } synchronized IMethodBinding resolveMethod ( SuperMethodInvocation method ) { } synchronized ITypeBinding resolveTypeBindingForName ( Name name ) { } synchronized IBinding resolveName ( Name name ) { } synchronized IPackageBinding resolvePackage ( PackageDeclaration pkg ) { if ( ( this . scope ) == null ) return null ; try { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) ( this . newAstToOldAst . get ( pkg ) ) ) ; if ( node instanceof ImportReference ) { ImportReference importReference = ( ( ImportReference ) ( node ) ) ; <START_BUG> Binding binding = this . scope . getTypeOrPackage ( CharOperation . subarray ( importReference . tokens , 0 , importReference . tokens . length ) ) ; <END_BUG> if ( ( binding != null ) && ( binding . isValidBinding ( ) ) ) { if ( binding instanceof ReferenceBinding ) { ReferenceBinding referenceBinding = ( ( ReferenceBinding ) ( binding ) ) ; binding = referenceBinding . fPackage ; } if ( binding instanceof PackageBinding ) { IPackageBinding packageBinding = getPackageBinding ( ( ( PackageBinding ) ( binding ) ) ) ; if ( packageBinding == null ) { return null ; } this . bindingsToAstNodes . put ( packageBinding , pkg ) ; String key = packageBinding . getKey ( ) ; if ( key != null ) { this . bindingTables . bindingKeysToBindings . put ( key , packageBinding ) ; } return packageBinding ; } } } } catch ( AbortCompilation e ) { } return null ; } synchronized IBinding resolveReference ( MemberRef ref ) { } synchronized IMemberValuePairBinding resolveMemberValuePair ( MemberValuePair memberValuePair ) { } synchronized IBinding resolveReference ( MethodRef ref ) { } ITypeBinding resolveType ( AnnotationTypeDeclaration type ) { } synchronized ITypeBinding resolveType ( AnonymousClassDeclaration type ) { } ITypeBinding resolveType ( EnumDeclaration type ) { } synchronized ITypeBinding resolveType ( Type type ) { } synchronized ITypeBinding resolveType ( TypeDeclaration type ) { } synchronized ITypeBinding resolveTypeParameter ( TypeParameter typeParameter ) { } synchronized IVariableBinding resolveVariable ( EnumConstantDeclaration enumConstant ) { } synchronized IVariableBinding resolveVariable ( VariableDeclaration variable ) { } synchronized ITypeBinding resolveWellKnownType ( String name ) { } synchronized IAnnotationBinding resolveAnnotation ( final Annotation domASTNode ) { } public CompilationUnitScope scope ( ) { } synchronized void store ( ASTNode node , org . eclipse . jdt . internal . compiler . ast . ASTNode oldASTNode ) { } synchronized void updateKey ( ASTNode node , ASTNode newNode ) { } ITypeBinding resolveArrayType ( ITypeBinding typeBinding , int dimensions ) { } }

Fix:
Binding binding = this . scope . getOnlyPackage ( CharOperation . subarray ( importReference . tokens , 0 , importReference . tokens . length ) ) ;