Buggy code:
if ( typeVariable != null ) return typeVariable ; } insideStaticContext |= methodScope . isStatic ; insideTypeAnnotation = methodScope . insideTypeAnnotation ; case Scope . BLOCK_SCOPE : ReferenceBinding localType = ( ( BlockScope ) ( scope ) ) . findLocalType ( name ) ; if ( localType != null ) { if ( ( foundType != null ) && ( foundType != localType ) ) return new ProblemReferenceBinding ( name , ProblemReasons . InheritedNameHidesEnclosingName ) ; return localType ; } break ; case Scope . CLASS_SCOPE : SourceTypeBinding sourceType = ( ( ClassScope ) ( scope ) ) . referenceContext . binding ; if ( sourceType . isHierarchyBeingConnected ( ) ) { TypeVariableBinding typeVariable = sourceType . getTypeVariable ( name ) ; if ( typeVariable != null ) return typeVariable ; if ( CharOperation . equals ( name , sourceType . sourceName ) ) return sourceType ; insideStaticContext |= ( ( sourceType . modifiers ) & ( AccStatic ) ) != 0 ; break ; } TypeVariableBinding typeVariable = sourceType . getTypeVariable ( name ) ; if ( typeVariable != null ) { if ( insideStaticContext ) return new ProblemReferenceBinding ( name , ProblemReasons . NonStaticReferenceInStaticContext ) ; return typeVariable ; } if ( ! insideTypeAnnotation ) { ReferenceBinding memberType = findMemberType ( name , sourceType ) ; if ( memberType != null ) { if ( ( memberType . problemId ( ) ) == ( ProblemReasons . Ambiguous ) ) { if ( ( foundType == null ) || ( ( foundType . problemId ( ) ) == ( ProblemReasons . NotVisible ) ) ) return memberType ; return new ProblemReferenceBinding ( name , ProblemReasons . InheritedNameHidesEnclosingName ) ; } if ( memberType . isValidBinding ( ) ) { if ( ( sourceType == ( memberType . enclosingType ( ) ) ) || ( ( environment ( ) . options . complianceLevel ) >= ( ClassFileConstants . JDK1_4 ) ) ) { if ( ( insideStaticContext && ( ! ( memberType . isStatic ( ) ) ) ) && ( sourceType . isGenericType ( ) ) ) return new ProblemReferenceBinding ( name , ProblemReasons . NonStaticReferenceInStaticContext ) ; if ( foundType == null ) return memberType ; if ( ( foundType . isValidBinding ( ) ) && ( foundType != memberType ) ) return new ProblemReferenceBinding ( name , ProblemReasons . InheritedNameHidesEnclosingName ) ; } } if ( ( foundType == null ) || ( ( ( foundType . problemId ( ) ) == ( ProblemReasons . NotVisible ) ) && ( ( memberType . problemId ( ) ) != ( ProblemReasons . NotVisible ) ) ) ) foundType = memberType ; } } insideTypeAnnotation = false ; insideStaticContext |= ( ( sourceType . modifiers ) & ( AccStatic ) ) != 0 ; if ( CharOperation . equals ( sourceType . sourceName , name ) ) { if ( ( ( foundType != null ) && ( foundType != sourceType ) ) && ( ( foundType . problemId ( ) ) != ( ProblemReasons . NotVisible ) ) ) return new ProblemReferenceBinding ( name , ProblemReasons . InheritedNameHidesEnclosingName ) ; return sourceType ; } break ; case Scope . COMPILATION_UNIT_SCOPE : break done ; } scope = scope . parent ; } if ( ( foundType != null ) && ( ( foundType . problemId ( ) ) != ( ProblemReasons . NotVisible ) ) ) return foundType ; } CompilationUnitScope unitScope = ( ( CompilationUnitScope ) ( scope ) ) ; HashtableOfObject typeOrPackageCache = unitScope . typeOrPackageCache ; if ( typeOrPackageCache != null ) { Binding binding = ( ( Binding ) ( typeOrPackageCache . get ( name ) ) ) ; if ( binding != null ) { if ( binding instanceof ImportBinding ) { ImportReference importReference = ( ( ImportBinding ) ( binding ) ) . reference ; if ( importReference != null ) importReference . used = true ; typeOrPackageCache . put ( name , ( binding = ( ( ImportBinding ) ( binding ) ) . resolvedImport ) ) ; } if ( ( mask & ( Binding . TYPE ) ) != 0 ) { <START_BUG> if ( ( foundType != null ) && ( ( binding . problemId ( ) ) != ( ProblemReasons . Ambiguous ) ) ) <END_BUG> return foundType ; if ( binding instanceof ReferenceBinding ) return binding ; } if ( ( ( mask & ( Binding . PACKAGE ) ) != 0 ) && ( binding instanceof PackageBinding ) ) return binding ; } } if ( ( mask & ( Binding . TYPE ) ) != 0 ) { ImportBinding [ ] imports = unitScope . imports ; if ( ( imports != null ) && ( typeOrPackageCache == null ) ) { for ( int i = 0 , length = imports . length ; i < length ; i ++ ) { ImportBinding typeImport = imports [ i ] ; if ( ! ( typeImport . onDemand ) ) { if ( CharOperation . equals ( typeImport . compoundName [ ( ( typeImport . compoundName . length ) - 1 ) ] , name ) ) { Binding resolvedImport = unitScope . resolveSingleImport ( typeImport ) ; if ( ( resolvedImport != null ) && ( resolvedImport instanceof TypeBinding ) ) { ImportReference importReference = typeImport . reference ; if ( importReference != null ) importReference . used = true ; return resolvedImport ; } } } } } PackageBinding currentPackage = unitScope . fPackage ; unitScope . recordReference ( currentPackage . compoundName , name ) ; Binding binding = currentPackage . getTypeOrPackage ( name ) ; if ( binding instanceof ReferenceBinding ) { if ( typeOrPackageCache != null ) typeOrPackageCache . put ( name , binding ) ; return binding ; } if ( imports != null ) { boolean foundInImport = false ;

Fix:
if ( ( ( foundType != null ) && ( ( foundType . problemId ( ) ) != ( ProblemReasons . NotVisible ) ) ) && ( ( binding . problemId ( ) ) != ( ProblemReasons . Ambiguous ) ) )