Buggy code:
public class UnaryExpression extends OperatorExpression { public Expression expression ; public Constant optimizedBooleanConstant ; public UnaryExpression ( Expression expression , int operator ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { } public Constant optimizedBooleanConstant ( ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { } public void generateOptimizedBoolean ( BlockScope currentScope , CodeStream codeStream , Label trueLabel , Label falseLabel , boolean valueRequired ) { } public StringBuffer printExpressionNoParenthesis ( int indent , StringBuffer output ) { } public TypeBinding resolveType ( BlockScope scope ) { boolean expressionIsCast ; if ( ( expressionIsCast = ( this . expression ) instanceof CastExpression ) == true ) <START_BUG> this . expression . bits |= IgnoreNeedForCastCheckMASK ; <END_BUG> TypeBinding expressionType = this . expression . resolveType ( scope ) ; if ( expressionType == null ) { this . constant = NotAConstant ; return null ; } int expressionTypeID = expressionType . id ; boolean use15specifics = ( scope . compilerOptions ( ) . sourceLevel ) >= ( JDK1_5 ) ; if ( use15specifics ) { if ( ! ( expressionType . isBaseType ( ) ) ) { expressionTypeID = scope . environment ( ) . computeBoxingType ( expressionType ) . id ; } } if ( expressionTypeID > 15 ) { this . constant = NotAConstant ; scope . problemReporter ( ) . invalidOperator ( this , expressionType ) ; return null ; } int tableId ; switch ( ( ( bits ) & ( ASTNode . OperatorMASK ) ) > > ( ASTNode . OperatorSHIFT ) ) { case OperatorIds . NOT : tableId = OperatorIds . AND_AND ; break ; case OperatorIds . TWIDDLE : tableId = OperatorIds . LEFT_SHIFT ; break ; default : tableId = OperatorIds . MINUS ; } int operatorSignature = OperatorExpression . OperatorSignatures [ tableId ] [ ( ( expressionTypeID << 4 ) + expressionTypeID ) ] ; this . expression . computeConversion ( scope , TypeBinding . wellKnownType ( scope , ( ( operatorSignature > > > 16 ) & 15 ) ) , expressionType ) ; this . bits |= operatorSignature & 15 ; switch ( operatorSignature & 15 ) { case TypeIds . T_boolean : this . resolvedType = BooleanBinding ; break ; case TypeIds . T_byte : this . resolvedType = ByteBinding ; break ; case TypeIds . T_char : this . resolvedType = CharBinding ; break ; case TypeIds . T_double : this . resolvedType = DoubleBinding ; break ; case TypeIds . T_float : this . resolvedType = FloatBinding ; break ; case TypeIds . T_int : this . resolvedType = IntBinding ; break ; case TypeIds . T_long : this . resolvedType = LongBinding ; break ; default : this . constant = Constant . NotAConstant ; if ( expressionTypeID != ( TypeIds . T_undefined ) ) scope . problemReporter ( ) . invalidOperator ( this , expressionType ) ; return null ; } if ( ( this . expression . constant ) != ( Constant . NotAConstant ) ) { this . constant = Constant . computeConstantOperation ( this . expression . constant , expressionTypeID , ( ( ( bits ) & ( ASTNode . OperatorMASK ) ) > > ( ASTNode . OperatorSHIFT ) ) ) ; } else { this . constant = Constant . NotAConstant ; if ( ( ( ( bits ) & ( ASTNode . OperatorMASK ) ) > > ( ASTNode . OperatorSHIFT ) ) == ( OperatorIds . NOT ) ) { Constant cst = expression . optimizedBooleanConstant ( ) ; if ( cst != ( Constant . NotAConstant ) ) this . optimizedBooleanConstant = Constant . fromValue ( ( ! ( cst . booleanValue ( ) ) ) ) ; } } if ( expressionIsCast ) { CastExpression . checkNeedForArgumentCast ( scope , tableId , operatorSignature , this . expression , expressionTypeID ) ; } return this . resolvedType ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { } }

Fix:
this . expression . bits |= ASTNode . DisableUnnecessaryCastCheck ;