Buggy code:
public class AllocationExpression extends Expression implements InvocationSite { public TypeReference type ; public Expression [ ] arguments ; public MethodBinding binding ; protected MethodBinding codegenBinding ; MethodBinding syntheticAccessor ; public TypeReference [ ] typeArguments ; public TypeBinding [ ] genericTypeArguments ; public FieldDeclaration enumConstant ; public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { } public void checkCapturedLocalInitializationIfNecessary ( ReferenceBinding checkedType , BlockScope currentScope , FlowInfo flowInfo ) { } public Expression enclosingInstance ( ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { } public TypeBinding [ ] genericTypeArguments ( ) { } public boolean isSuperAccess ( ) { } public boolean isTypeAccess ( ) { } public void manageEnclosingInstanceAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { } public StringBuffer printExpression ( int indent , StringBuffer output ) { } public TypeBinding resolveType ( BlockScope scope ) { constant = NotAConstant ; if ( ( this . type ) == null ) { <START_BUG> this . resolvedType = scope . enclosingSourceType ( ) ; <END_BUG> } else { this . resolvedType = this . type . resolveType ( scope , true ) ; checkParameterizedAllocation : { if ( ( this . type ) instanceof ParameterizedQualifiedTypeReference ) { ReferenceBinding currentType = ( ( ReferenceBinding ) ( this . resolvedType ) ) ; if ( currentType == null ) return null ; do { if ( ( ( currentType . modifiers ) & ( ClassFileConstants . AccStatic ) ) != 0 ) break checkParameterizedAllocation ; if ( currentType . isRawType ( ) ) break checkParameterizedAllocation ; } while ( ( currentType = currentType . enclosingType ( ) ) != null ) ; ParameterizedQualifiedTypeReference qRef = ( ( ParameterizedQualifiedTypeReference ) ( this . type ) ) ; for ( int i = ( qRef . typeArguments . length ) - 2 ; i >= 0 ; i -- ) { if ( ( qRef . typeArguments [ i ] ) != null ) { scope . problemReporter ( ) . illegalQualifiedParameterizedTypeAllocation ( this . type , this . resolvedType ) ; break ; } } } } } if ( ( this . typeArguments ) != null ) { int length = this . typeArguments . length ; boolean argHasError = false ; this . genericTypeArguments = new TypeBinding [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { if ( ( this . genericTypeArguments [ i ] = this . typeArguments [ i ] . resolveType ( scope , true ) ) == null ) { argHasError = true ; } } if ( argHasError ) { return null ; } } boolean argsContainCast = false ; TypeBinding [ ] argumentTypes = NoParameters ; if ( ( arguments ) != null ) { boolean argHasError = false ; int length = arguments . length ; argumentTypes = new TypeBinding [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { Expression argument = this . arguments [ i ] ; if ( argument instanceof CastExpression ) { argument . bits |= ASTNode . DisableUnnecessaryCastCheck ; argsContainCast = true ; } if ( ( argumentTypes [ i ] = argument . resolveType ( scope ) ) == null ) { argHasError = true ; } } if ( argHasError ) { return this . resolvedType ; } } if ( ( this . resolvedType ) == null ) return null ; if ( ( ( this . type ) != null ) && ( ! ( this . resolvedType . canBeInstantiated ( ) ) ) ) { scope . problemReporter ( ) . cannotInstantiate ( type , this . resolvedType ) ; return this . resolvedType ; } ReferenceBinding allocationType = ( ( ReferenceBinding ) ( this . resolvedType ) ) ; if ( ! ( ( binding = scope . getConstructor ( allocationType , argumentTypes , this ) ) . isValidBinding ( ) ) ) { if ( ( binding . declaringClass ) == null ) binding . declaringClass = allocationType ; scope . problemReporter ( ) . invalidConstructor ( this , binding ) ; return this . resolvedType ; } if ( isMethodUseDeprecated ( binding , scope ) ) scope . problemReporter ( ) . deprecatedMethod ( binding , this ) ; ASTNode . checkInvocationArguments ( scope , null , allocationType , this . binding , this . arguments , argumentTypes , argsContainCast , this ) ; return allocationType ; } public void setActualReceiverType ( ReferenceBinding receiverType ) { } public void setDepth ( int i ) { } public void setFieldIndex ( int i ) { } public void traverse ( ASTVisitor visitor , BlockScope scope ) { } }

Fix:
this . resolvedType = scope . enclosingReceiverType ( ) ;