Buggy code:
public class ParameterizedSingleTypeReference extends ArrayTypeReference { public TypeReference [ ] typeArguments ; public ParameterizedSingleTypeReference ( char [ ] name , TypeReference [ ] typeArguments , int dim , long pos ) { } public void checkBounds ( Scope scope ) { } public TypeReference copyDims ( int dim ) { } public char [ ] [ ] getParameterizedTypeName ( ) { } protected TypeBinding getTypeBinding ( Scope scope ) { } private TypeBinding internalResolveType ( Scope scope , ReferenceBinding enclosingType , boolean checkBounds ) { this . constant = Constant . NotAConstant ; if ( ( ( this . bits ) & ( ASTNode . DidResolve ) ) != 0 ) { if ( ( ( this . resolvedType ) != null ) && ( ! ( this . resolvedType . isValidBinding ( ) ) ) ) return null ; return this . resolvedType ; } this . bits |= ASTNode . DidResolve ; if ( enclosingType == null ) { this . resolvedType = scope . getType ( token ) ; if ( ! ( this . resolvedType . isValidBinding ( ) ) ) { reportInvalidType ( scope ) ; boolean isClassScope = ( scope . kind ) == ( Scope . CLASS_SCOPE ) ; int argLength = this . typeArguments . length ; for ( int i = 0 ; i < argLength ; i ++ ) { TypeReference typeArgument = this . typeArguments [ i ] ; if ( isClassScope ) { typeArgument . resolveType ( ( ( ClassScope ) ( scope ) ) ) ; } else { typeArgument . resolveType ( ( ( BlockScope ) ( scope ) ) , checkBounds ) ; } } return null ; } enclosingType = this . resolvedType . enclosingType ( ) ; if ( ( enclosingType != null ) && ( ( enclosingType . isGenericType ( ) ) || ( enclosingType . isParameterizedType ( ) ) ) ) { ReferenceBinding currentType = ( ( ReferenceBinding ) ( this . resolvedType ) ) ; <START_BUG> enclosingType = ( currentType . isStatic ( ) ) ? ( ( ReferenceBinding ) ( scope . environment ( ) . convertToRawType ( enclosingType ) ) ) : scope . environment ( ) . convertToParameterizedType ( enclosingType ) ; <END_BUG> } } else { this . resolvedType = scope . getMemberType ( token , enclosingType ) ; if ( ! ( this . resolvedType . isValidBinding ( ) ) ) { scope . problemReporter ( ) . invalidEnclosingType ( this , this . resolvedType , enclosingType ) ; return null ; } if ( isTypeUseDeprecated ( this . resolvedType , scope ) ) scope . problemReporter ( ) . deprecatedType ( this . resolvedType , this ) ; } boolean isClassScope = ( scope . kind ) == ( Scope . CLASS_SCOPE ) ; TypeReference keep = null ; if ( isClassScope ) { keep = ( ( ClassScope ) ( scope ) ) . superTypeReference ; ( ( ClassScope ) ( scope ) ) . superTypeReference = null ; } ReferenceBinding currentType = ( ( ReferenceBinding ) ( this . resolvedType ) ) ; int argLength = this . typeArguments . length ; TypeBinding [ ] argTypes = new TypeBinding [ argLength ] ; boolean argHasError = false ; for ( int i = 0 ; i < argLength ; i ++ ) { TypeReference typeArgument = this . typeArguments [ i ] ; TypeBinding argType = ( isClassScope ) ? typeArgument . resolveTypeArgument ( ( ( ClassScope ) ( scope ) ) , currentType , i ) : typeArgument . resolveTypeArgument ( ( ( BlockScope ) ( scope ) ) , currentType , i ) ; if ( argType == null ) { argHasError = true ; } else { argTypes [ i ] = argType ; } } if ( argHasError ) return null ; if ( isClassScope ) { ( ( ClassScope ) ( scope ) ) . superTypeReference = keep ; if ( ( ( ClassScope ) ( scope ) ) . detectHierarchyCycle ( currentType , this ) ) return null ; } TypeVariableBinding [ ] typeVariables = currentType . typeVariables ( ) ; if ( typeVariables == ( Binding . NO_TYPE_VARIABLES ) ) { scope . problemReporter ( ) . nonGenericTypeCannotBeParameterized ( this , currentType , argTypes ) ; return null ; } else if ( argLength != ( typeVariables . length ) ) { scope . problemReporter ( ) . incorrectArityForParameterizedType ( this , currentType , argTypes ) ; return null ; } else if ( ! ( currentType . isStatic ( ) ) ) { ReferenceBinding actualEnclosing = currentType . enclosingType ( ) ; if ( ( actualEnclosing != null ) && ( actualEnclosing . isRawType ( ) ) ) { scope . problemReporter ( ) . rawMemberTypeCannotBeParameterized ( this , scope . environment ( ) . createRawType ( ( ( ReferenceBinding ) ( currentType . erasure ( ) ) ) , actualEnclosing ) , argTypes ) ; return null ; } } ParameterizedTypeBinding parameterizedType = scope . environment ( ) . createParameterizedType ( ( ( ReferenceBinding ) ( currentType . erasure ( ) ) ) , argTypes , enclosingType ) ; if ( checkBounds ) parameterizedType . boundCheck ( scope , this . typeArguments ) ; this . resolvedType = parameterizedType ; if ( isTypeUseDeprecated ( this . resolvedType , scope ) ) reportDeprecatedType ( this . resolvedType , scope ) ; if ( ( this . dimensions ) > 0 ) { if ( ( dimensions ) > 255 ) scope . problemReporter ( ) . tooManyDimensions ( this ) ; this . resolvedType = scope . createArrayType ( this . resolvedType , dimensions ) ; } return this . resolvedType ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { } public TypeBinding resolveType ( BlockScope scope , boolean checkBounds ) { } public TypeBinding resolveType ( ClassScope scope ) { }

Fix:
enclosingType = ( currentType . isStatic ( ) ) ? ( ( ReferenceBinding ) ( scope . environment ( ) . convertToRawType ( enclosingType , false ) ) ) : scope . environment ( ) . convertToParameterizedType ( enclosingType ) ;