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 checkNeedForAssignedCast ( BlockScope scope , TypeBinding expectedType , CastExpression rhs ) { } public static void checkNeedForCastCast ( BlockScope scope , CastExpression enclosingCast ) { } 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 ) { if ( match == castType ) { if ( ( ! isNarrowing ) && ( match == ( this . resolvedType . leafComponentType ( ) ) ) ) { tagAsUnnecessaryCast ( scope , castType ) ; } return true ; } if ( match != null ) { if ( isNarrowing ? match . isProvablyDistinct ( expressionType ) : castType . isProvablyDistinct ( match ) ) { return false ; } } switch ( castType . kind ( ) ) { case Binding . PARAMETERIZED_TYPE : if ( ! ( castType . isReifiable ( ) ) ) { if ( match == null ) { this . bits |= ASTNode . UnsafeCast ; return true ; } switch ( match . kind ( ) ) { case Binding . PARAMETERIZED_TYPE : if ( isNarrowing ) { if ( ( expressionType . isRawType ( ) ) || ( ! ( expressionType . isEquivalentTo ( match ) ) ) ) { this . bits |= ASTNode . UnsafeCast ; return true ; } ParameterizedTypeBinding paramCastType = ( ( ParameterizedTypeBinding ) ( castType ) ) ; ParameterizedTypeBinding paramMatch = ( ( ParameterizedTypeBinding ) ( match ) ) ; TypeBinding [ ] castArguments = paramCastType . arguments ; <START_BUG> int length = castArguments . length ; <END_BUG> if ( ( ( paramMatch . arguments ) == null ) || ( length > ( paramMatch . arguments . length ) ) ) { this . bits |= ASTNode . UnsafeCast ; } else if ( ( ( paramCastType . tagBits ) & ( ( TagBits . HasDirectWildcard ) | ( TagBits . HasTypeVariable ) ) ) != 0 ) { nextAlternateArgument : for ( int i = 0 ; i < length ; i ++ ) { switch ( castArguments [ i ] . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . TYPE_PARAMETER : break ; default : continue nextAlternateArgument ; } TypeBinding [ ] alternateArguments ; System . arraycopy ( paramCastType . arguments , 0 , ( alternateArguments = new TypeBinding [ length ] ) , 0 , length ) ; alternateArguments [ i ] = scope . getJavaLangObject ( ) ; LookupEnvironment environment = scope . environment ( ) ; ParameterizedTypeBinding alternateCastType = environment . createParameterizedType ( ( ( ReferenceBinding ) ( castType . erasure ( ) ) ) , alternateArguments , castType . enclosingType ( ) ) ; if ( ( alternateCastType . findSuperTypeOriginatingFrom ( expressionType ) ) == match ) { this . bits |= ASTNode . UnsafeCast ; break ; } } } return true ; } else { if ( ! ( match . isEquivalentTo ( castType ) ) ) { this . bits |= ASTNode . UnsafeCast ; return true ; } } break ; case Binding . RAW_TYPE : this . bits |= ASTNode . UnsafeCast ; return true ; default : if ( isNarrowing ) { this . bits |= ASTNode . UnsafeCast ; return true ; } break ; } } break ; case Binding . ARRAY_TYPE : TypeBinding leafType = castType . leafComponentType ( ) ; if ( isNarrowing && ( ( ! ( leafType . isReifiable ( ) ) ) || ( leafType . isTypeVariable ( ) ) ) ) { this . bits |= ASTNode . UnsafeCast ; return true ; } break ; case Binding . TYPE_PARAMETER : this . bits |= ASTNode . UnsafeCast ; return true ; } if ( ( ! isNarrowing ) && ( match == ( this . resolvedType . leafComponentType ( ) ) ) ) { tagAsUnnecessaryCast ( scope , castType ) ; } return true ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { } public Expression innermostCastedExpression ( ) { } public LocalVariableBinding localVariableBinding ( ) { } public int nullStatus ( FlowInfo flowInfo ) { } public Constant optimizedBooleanConstant ( ) { } public StringBuffer printExpression ( int indent , StringBuffer output ) { } public TypeBinding resolveType ( BlockScope scope ) { } 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:
int length = ( castArguments == null ) ? 0 : castArguments . length ;