Buggy code:
public abstract class Expression extends Statement { public static final boolean isConstantValueRepresentable ( Constant constant , int constantTypeID , int targetTypeID ) { } public Constant constant ; public int implicitConversion ; public TypeBinding resolvedType ; public Expression ( ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo , boolean valueRequired ) { } public final boolean checkCastTypesCompatibility ( BlockScope scope , TypeBinding castType , TypeBinding expressionType , Expression expression ) { } private MethodBinding [ ] getAllInheritedMethods ( ReferenceBinding binding ) { } private void getAllInheritedMethods0 ( ReferenceBinding binding , ArrayList collector ) { } public boolean checkUnsafeCast ( Scope scope , TypeBinding castType , TypeBinding expressionType , TypeBinding match , boolean isNarrowing ) { if ( match == castType ) { if ( ! isNarrowing ) tagAsUnnecessaryCast ( scope , castType ) ; return true ; } if ( ( castType . isBoundParameterizedType ( ) ) || ( castType . isGenericType ( ) ) ) { <START_BUG> if ( match . isProvablyDistinctFrom ( ( isNarrowing ? expressionType : castType ) ) ) { <END_BUG> reportIllegalCast ( scope , castType , expressionType ) ; return false ; } } if ( ! isNarrowing ) tagAsUnnecessaryCast ( scope , castType ) ; return true ; } public void computeConversion ( Scope scope , TypeBinding runtimeTimeType , TypeBinding compileTimeType ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { } public void generateOptimizedBoolean ( BlockScope currentScope , CodeStream codeStream , Label trueLabel , Label falseLabel , boolean valueRequired ) { } public void generateOptimizedStringConcatenation ( BlockScope blockScope , CodeStream codeStream , int typeID ) { } public void generateOptimizedStringConcatenationCreation ( BlockScope blockScope , CodeStream codeStream , int typeID ) { } public boolean isCompactableOperation ( ) { } public boolean isConstantValueOfTypeAssignableToType ( TypeBinding constantType , TypeBinding targetType ) { } public boolean isTypeReference ( ) { } public Constant optimizedBooleanConstant ( ) { } public StringBuffer print ( int indent , StringBuffer output ) { } public abstract StringBuffer printExpression ( int indent , StringBuffer output ) { } public StringBuffer printStatement ( int indent , StringBuffer output ) { } public void reportIllegalCast ( Scope scope , TypeBinding castType , TypeBinding expressionType ) { } public void resolve ( BlockScope scope ) { } public TypeBinding resolveType ( BlockScope scope ) { } public TypeBinding resolveType ( ClassScope classScope ) { } public TypeBinding resolveTypeExpecting ( BlockScope scope , TypeBinding expectedType ) { } public void setExpectedType ( TypeBinding expectedType ) { } public void tagAsUnnecessaryCast ( Scope scope , TypeBinding castType ) { } public void tagAsNeedCheckCast ( ) { } public Expression toTypeReference ( ) { } public void traverse ( ASTVisitor visitor , BlockScope scope ) { } public void traverse ( ASTVisitor visitor , ClassScope scope ) { } public void traverse ( ASTVisitor visitor , CompilationUnitScope scope ) { } }

Fix:
if ( match . isProvablyDistinctFrom ( ( isNarrowing ? expressionType : castType ) , 0 ) ) {