static int lastArgMatchesVarg ( Parameter [ ] params , ClassNode ... args ) { if ( ! isVargs ( params ) ) return - 1 ; // case length ==0 handled already // we have now two cases, // the argument is wrapped in the vargs array or // the argument is an array that can be used for the vargs part directly // we test only the wrapping part, since the non wrapping is done already ClassNode lastParamType = params [ params . length - 1 ] . getType ( ) ; ClassNode ptype = lastParamType . getComponentType ( ) ; ClassNode arg = args [ args . length - 1 ] ; if ( isNumberType ( ptype ) && isNumberType ( arg ) && ! ptype . equals ( arg ) ) return - 1 ; return isAssignableTo ( arg , ptype ) ? Math . min ( getDistance ( arg , lastParamType ) , getDistance ( arg , ptype ) ) : - 1 ; }
Checks if the last argument matches the vararg type .