Buggy code:
public abstract class Scope { public static final int BLOCK_SCOPE = 1 ; public static final int CLASS_SCOPE = 3 ; public static final int COMPILATION_UNIT_SCOPE = 4 ; public static final int METHOD_SCOPE = 2 ; public static final int NOT_COMPATIBLE = - 1 ; public static final int COMPATIBLE = 0 ; public static final int AUTOBOX_COMPATIBLE = 1 ; public static final int VARARGS_COMPATIBLE = 2 ; public static final int EQUAL_OR_MORE_SPECIFIC = - 1 ; public static final int NOT_RELATED = 0 ; public static final int MORE_GENERIC = 1 ; public int kind ; public Scope parent ; protected Scope ( int kind , Scope parent ) { } public static int compareTypes ( TypeBinding left , TypeBinding right ) { } public static TypeBinding convertEliminatingTypeVariables ( TypeBinding originalType , ReferenceBinding genericType , int rank , Set eliminatedVariables ) { } public static TypeBinding getBaseType ( char [ ] name ) { } public static ReferenceBinding [ ] greaterLowerBound ( ReferenceBinding [ ] types ) { } public static TypeBinding [ ] greaterLowerBound ( TypeBinding [ ] types ) { } public static ReferenceBinding [ ] substitute ( Substitution substitution , ReferenceBinding [ ] originalTypes ) { } public static TypeBinding substitute ( Substitution substitution , TypeBinding originalType ) { } public static TypeBinding [ ] substitute ( Substitution substitution , TypeBinding [ ] originalTypes ) { } public TypeBinding boxing ( TypeBinding type ) { } public final ClassScope classScope ( ) { } public final CompilationUnitScope compilationUnitScope ( ) { } public final CompilerOptions compilerOptions ( ) { } protected final MethodBinding computeCompatibleMethod ( MethodBinding method , TypeBinding [ ] arguments , InvocationSite invocationSite ) { } protected boolean connectTypeVariables ( TypeParameter [ ] typeParameters , boolean checkForErasedCandidateCollisions ) { } public ArrayBinding createArrayType ( TypeBinding type , int dimension ) { } public TypeVariableBinding [ ] createTypeVariables ( TypeParameter [ ] typeParameters , Binding declaringElement ) { } public final ClassScope enclosingClassScope ( ) { } public final MethodScope enclosingMethodScope ( ) { } public final ReferenceBinding enclosingReceiverType ( ) { } public ReferenceContext enclosingReferenceContext ( ) { } public final SourceTypeBinding enclosingSourceType ( ) { } public final LookupEnvironment environment ( ) { } protected MethodBinding findDefaultAbstractMethod ( ReferenceBinding receiverType , char [ ] selector , TypeBinding [ ] argumentTypes , InvocationSite invocationSite , ReferenceBinding classHierarchyStart , ObjectVector found , MethodBinding concreteMatch ) { } public ReferenceBinding findDirectMemberType ( char [ ] typeName , ReferenceBinding enclosingType ) { } public MethodBinding findExactMethod ( ReferenceBinding receiverType , char [ ] selector , TypeBinding [ ] argumentTypes , InvocationSite invocationSite ) { } public FieldBinding findField ( TypeBinding receiverType , char [ ] fieldName , InvocationSite invocationSite , boolean needResolve ) { } public ReferenceBinding findMemberType ( char [ ] typeName , ReferenceBinding enclosingType ) { if ( ( ( enclosingType . tagBits ) & ( TagBits . HasNoMemberTypes ) ) != 0 ) return null ; ReferenceBinding enclosingSourceType = enclosingSourceType ( ) ; PackageBinding currentPackage = getCurrentPackage ( ) ; CompilationUnitScope unitScope = compilationUnitScope ( ) ; unitScope . recordReference ( enclosingType , typeName ) ; ReferenceBinding memberType = enclosingType . getMemberType ( typeName ) ; if ( memberType != null ) { unitScope . recordTypeReference ( memberType ) ; <START_BUG> if ( enclosingSourceType == null ? memberType . canBeSeenBy ( currentPackage ) : memberType . canBeSeenBy ( enclosingType , enclosingSourceType ) ) <END_BUG> return memberType ; return new ProblemReferenceBinding ( new char [ ] [ ] { typeName } , memberType , ProblemReasons . NotVisible ) ; } ReferenceBinding currentType = enclosingType ; ReferenceBinding [ ] interfacesToVisit = null ; int nextPosition = 0 ; ReferenceBinding visibleMemberType = null ; boolean keepLooking = true ; ReferenceBinding notVisible = null ; while ( keepLooking ) { ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces == null ) { ReferenceBinding sourceType = ( currentType . isParameterizedType ( ) ) ? ( ( ParameterizedTypeBinding ) ( currentType ) ) . genericType ( ) : currentType ; if ( sourceType . isHierarchyBeingConnected ( ) ) return null ; ( ( SourceTypeBinding ) ( sourceType ) ) . scope . connectTypeHierarchy ( ) ; itsInterfaces = currentType . superInterfaces ( ) ; } if ( ( itsInterfaces != null ) && ( itsInterfaces != ( Binding . NO_SUPERINTERFACES ) ) ) { if ( interfacesToVisit == null ) { interfacesToVisit = itsInterfaces ; nextPosition = interfacesToVisit . length ; } else { int itsLength = itsInterfaces . length ; if ( ( nextPosition + itsLength ) >= ( interfacesToVisit . length ) ) System . arraycopy ( interfacesToVisit , 0 , ( interfacesToVisit = new ReferenceBinding [ ( nextPosition + itsLength ) + 5 ] ) , 0 , nextPosition ) ; nextInterface : for ( int a = 0 ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = 0 ; b < nextPosition ; b ++ ) if ( next == ( interfacesToVisit [ b ] ) ) continue nextInterface ; interfacesToVisit [ ( nextPosition ++ ) ] = next ; } } } if ( ( currentType = currentType . superclass ( ) ) == null ) break ; unitScope . recordReference ( currentType , typeName ) ; if ( ( memberType = currentType . getMemberType ( typeName ) ) != null ) { unitScope . recordTypeReference ( memberType ) ; keepLooking = false ; if ( enclosingSourceType == null ? memberType . canBeSeenBy ( currentPackage ) : memberType . canBeSeenBy ( enclosingType , enclosingSourceType ) ) { if ( visibleMemberType == null ) visibleMemberType = memberType ; else return new ProblemReferenceBinding ( new char [ ] [ ] { typeName } , visibleMemberType , ProblemReasons . Ambiguous ) ; } else { notVisible = memberType ; } } } if ( interfacesToVisit != null ) { ProblemReferenceBinding ambiguous = null ;

Fix:
if ( ( enclosingSourceType == null ) || ( ( ( this . parent ) == unitScope ) && ( ( ( enclosingSourceType . tagBits ) & ( TagBits . TypeVariablesAreConnected ) ) == 0 ) ) ? memberType . canBeSeenBy ( currentPackage ) : memberType . canBeSeenBy ( enclosingType , enclosingSourceType ) )