public static int allParametersAndArgumentsMatch ( Parameter [ ] params , ClassNode [ ] args ) { if ( params == null ) { params = Parameter . EMPTY_ARRAY ; } int dist = 0 ; if ( args . length < params . length ) return - 1 ; // we already know the lengths are equal for ( int i = 0 ; i < params . length ; i ++ ) { ClassNode paramType = params [ i ] . getType ( ) ; ClassNode argType = args [ i ] ; if ( ! isAssignableTo ( argType , paramType ) ) return - 1 ; else { if ( ! paramType . equals ( argType ) ) dist += getDistance ( argType , paramType ) ; } } return dist ; }
Checks that arguments and parameter types match .