Buggy code:
public class CastExpression extends Expression { public Expression expression ; public Expression type ; public TypeBinding expectedType ; public CastExpression ( Expression expression , Expression type ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { } public static void checkNeedForEnclosingInstanceCast ( BlockScope scope , Expression enclosingInstance , TypeBinding enclosingInstanceType , TypeBinding memberType ) { } public static void checkNeedForArgumentCast ( BlockScope scope , int operator , int operatorSignature , Expression expression , int expressionTypeId ) { } public static void checkNeedForArgumentCasts ( BlockScope scope , Expression receiver , TypeBinding receiverType , MethodBinding binding , Expression [ ] arguments , TypeBinding [ ] argumentTypes , final InvocationSite invocationSite ) { } public static void checkNeedForArgumentCasts ( BlockScope scope , int operator , int operatorSignature , Expression left , int leftTypeId , boolean leftIsCast , Expression right , int rightTypeId , boolean rightIsCast ) { } private static void checkAlternateBinding ( BlockScope scope , Expression receiver , TypeBinding receiverType , MethodBinding binding , Expression [ ] arguments , TypeBinding [ ] originalArgumentTypes , TypeBinding [ ] alternateArgumentTypes , final InvocationSite invocationSite ) { } public boolean checkUnsafeCast ( Scope scope , TypeBinding castType , TypeBinding expressionType , TypeBinding match , boolean isNarrowing ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { } public Expression innermostCastedExpression ( ) { } public LocalVariableBinding localVariableBinding ( ) { } public int nullStatus ( FlowInfo flowInfo ) { } public StringBuffer printExpression ( int indent , StringBuffer output ) { } public TypeBinding resolveType ( BlockScope scope ) { constant = Constant . NotAConstant ; implicitConversion = TypeIds . T_undefined ; if ( ( ( type ) instanceof TypeReference ) || ( ( ( type ) instanceof NameReference ) && ( ( ( ( type . bits ) & ( ASTNode . ParenthesizedMASK ) ) > > ( ASTNode . ParenthesizedSHIFT ) ) == 0 ) ) ) { this . resolvedType = type . resolveType ( scope ) ; expression . setExpectedType ( this . resolvedType ) ; TypeBinding expressionType = expression . resolveType ( scope ) ; if ( ( ( this . resolvedType ) != null ) && ( expressionType != null ) ) { boolean isLegal = checkCastTypesCompatibility ( scope , this . resolvedType , expressionType , this . expression ) ; this . expression . computeConversion ( scope , this . resolvedType , expressionType ) ; if ( isLegal ) { if ( ( ( this . bits ) & ( UnsafeCastMask ) ) != 0 ) { scope . problemReporter ( ) . unsafeCast ( this , scope ) ; } else if ( ( ( this . bits ) & ( ( UnnecessaryCastMASK ) | ( IgnoreNeedForCastCheckMASK ) ) ) == ( UnnecessaryCastMASK ) ) { if ( ! ( isIndirectlyUsed ( ) ) ) scope . problemReporter ( ) . unnecessaryCast ( this ) ; } <START_BUG> this . resolvedType = this . resolvedType . capture ( ) ; <END_BUG> } else { scope . problemReporter ( ) . typeCastError ( this , this . resolvedType , expressionType ) ; } } return this . resolvedType ; } else { TypeBinding expressionType = expression . resolveType ( scope ) ; if ( expressionType == null ) return null ; scope . problemReporter ( ) . invalidTypeReference ( type ) ; return null ; } } public void setExpectedType ( TypeBinding expectedType ) { } private boolean isIndirectlyUsed ( ) { } public void tagAsNeedCheckCast ( ) { } public void tagAsUnnecessaryCast ( Scope scope , TypeBinding castType ) { } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { } }

Fix:
this . resolvedType = this . resolvedType . capture ( scope , this . sourceEnd ) ;