private boolean typesAreCompatible ( Class < ? > [ ] paramTypes , Class < ? > [ ] constructorParamTypes ) { boolean matches = true ; for ( int i = 0 ; i < paramTypes . length ; i ++ ) { Class < ? > paramType = paramTypes [ i ] ; if ( paramType != null ) { Class < ? > inputParamType = translateFromPrimitive ( paramType ) ; Class < ? > constructorParamType = translateFromPrimitive ( constructorParamTypes [ i ] ) ; if ( inputParamType . isArray ( ) && Collection . class . isAssignableFrom ( constructorParamType ) ) { continue ; } if ( ! constructorParamType . isAssignableFrom ( inputParamType ) ) { matches = false ; break ; } } } return matches ; }
Checks if a set of types are compatible with the given set of constructor parameter types . If an input type is null then it is considered as a wildcard for matching purposes and always matches .