@@ -791,14 +791,14 @@ public static boolean isInstance(final Object obj, final Class<?> dest) {
791791 * @return -1 if the args satisfy the params, otherwise the index of the arg
792792 * that does not satisfy its parameter.
793793 */
794- public static int satisfies (final Type [] args , final Type [] params ) {
794+ public static int isApplicable (final Type [] args , final Type [] params ) {
795795 // create a HashMap to monitor the restrictions of the type variables.
796796 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds = new HashMap <>();
797797
798- return satisfies (args , params , typeBounds );
798+ return isApplicable (args , params , typeBounds );
799799 }
800800
801- public static int satisfies (final Type [] args , final Type [] params ,
801+ public static int isApplicable (final Type [] args , final Type [] params ,
802802 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
803803 {
804804 if (args .length != params .length ) {
@@ -809,21 +809,21 @@ public static int satisfies(final Type[] args, final Type[] params,
809809 Type arg = args [i ];
810810 Type param = params [i ];
811811 // First, check raw type assignability.
812- if (!satisfiesRawTypes (arg , param )) return i ;
812+ if (!isApplicableToRawTypes (arg , param )) return i ;
813813
814814 if (param instanceof ParameterizedType ) {
815- if (!satisfiesParameterizedTypes (arg , (ParameterizedType ) param ,
815+ if (!isApplicableToParameterizedTypes (arg , (ParameterizedType ) param ,
816816 typeBounds )) return i ;
817817 }
818818 else if (param instanceof TypeVariable ) {
819- if (!satisfiesTypeVariable (arg , (TypeVariable <?>) param ,
819+ if (!isApplicableToTypeVariable (arg , (TypeVariable <?>) param ,
820820 typeBounds )) return i ;
821821 }
822822 else if (param instanceof WildcardType ) {
823- if (!satisfiesWildcardType (arg , (WildcardType ) param )) return i ;
823+ if (!isApplicableToWildcardType (arg , (WildcardType ) param )) return i ;
824824 }
825825 else if (param instanceof GenericArrayType ) {
826- if (!satisfiesGenericArrayType (arg , (GenericArrayType ) param ,
826+ if (!isApplicableToGenericArrayType (arg , (GenericArrayType ) param ,
827827 typeBounds )) return i ;
828828 }
829829 final Type t = TypeToken .of (param ).resolveType (arg ).getType ();
@@ -832,13 +832,13 @@ else if (param instanceof GenericArrayType) {
832832 return -1 ;
833833 }
834834
835- public static boolean satisfies (
835+ public static boolean typesSatisfyVariables (
836836 final Map <TypeVariable <?>, Type > typeVarAssigns )
837837 {
838838 return TypeUtils .typesSatisfyVariables (typeVarAssigns );
839839 }
840840
841- private static boolean satisfiesRawTypes (final Type arg , final Type param ) {
841+ private static boolean isApplicableToRawTypes (final Type arg , final Type param ) {
842842 final List <Class <?>> srcClasses = Types .raws (arg );
843843 final List <Class <?>> destClasses = Types .raws (param );
844844 for (final Class <?> destClass : destClasses ) {
@@ -851,7 +851,7 @@ private static boolean satisfiesRawTypes(final Type arg, final Type param) {
851851 return true ;
852852 }
853853
854- private static boolean satisfiesParameterizedTypes (final Type arg ,
854+ private static boolean isApplicableToParameterizedTypes (final Type arg ,
855855 final ParameterizedType param ,
856856 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
857857 {
@@ -881,15 +881,15 @@ private static boolean satisfiesParameterizedTypes(final Type arg,
881881 if (destType instanceof TypeVariable <?>) {
882882 final Type srcType = srcTypes [i ];
883883 final TypeVariable <?> destTypeVar = (TypeVariable <?>) destType ;
884- if (!satisfiesTypeParameter (srcType , destTypeVar , typeBounds ))
884+ if (!isApplicableToTypeParameter (srcType , destTypeVar , typeBounds ))
885885 return false ;
886886 ignoredIndices .add (i );
887887 }
888888 }
889889 srcTypes = filterIndices (srcTypes , ignoredIndices );
890890 destTypes = filterIndices (destTypes , ignoredIndices );
891891 // recursively run satisfies on these arrays
892- return satisfies (srcTypes , destTypes , typeBounds ) == -1 ;
892+ return isApplicable (srcTypes , destTypes , typeBounds ) == -1 ;
893893 }
894894
895895 /**
@@ -907,7 +907,7 @@ private static boolean satisfiesParameterizedTypes(final Type arg,
907907 * @return {@code boolean} - true if the replacement of {@code param} with
908908 * {@code arg} is allowed.
909909 */
910- private static boolean satisfiesTypeParameter (final Type arg ,
910+ private static boolean isApplicableToTypeParameter (final Type arg ,
911911 final TypeVariable <?> param ,
912912 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
913913 {
@@ -926,11 +926,11 @@ private static boolean satisfiesTypeParameter(final Type arg,
926926 // if the type variable refers to some parameterized type (e.g. T extends
927927 // List<?>), call satisfiesTypeParameters on the bounds of param that
928928 // are ParameterizedTypes.
929- if (!satisfiesTypeVariableBounds (arg , param , typeBounds )) return false ;
929+ if (!isApplicableToTypeVariableBounds (arg , param , typeBounds )) return false ;
930930 return true ;
931931 }
932932
933- private static boolean satisfiesTypeVariable (final Type arg ,
933+ private static boolean isApplicableToTypeVariable (final Type arg ,
934934 final TypeVariable <?> param ,
935935 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
936936 {
@@ -947,7 +947,7 @@ private static boolean satisfiesTypeVariable(final Type arg,
947947 // if the type variable refers to some parameterized type (e.g. T extends
948948 // List<?>), call satisfiesTypeParameters on the bounds of param that
949949 // are ParameterizedTypes.
950- if (!satisfiesTypeVariableBounds (arg , param , typeBounds )) return false ;
950+ if (!isApplicableToTypeVariableBounds (arg , param , typeBounds )) return false ;
951951 return true ;
952952 }
953953
@@ -964,7 +964,7 @@ private static boolean satisfiesTypeVariable(final Type arg,
964964 * @return {@code boolean} - true if {@code arg} can satisfy the bounds of
965965 * {@code param}.
966966 */
967- private static boolean satisfiesTypeVariableBounds (final Type arg ,
967+ private static boolean isApplicableToTypeVariableBounds (final Type arg ,
968968 final TypeVariable <?> param ,
969969 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
970970 {
@@ -983,17 +983,17 @@ private static boolean satisfiesTypeVariableBounds(final Type arg,
983983 return false ;
984984 }
985985 if (paramBoundTypes [i ] instanceof TypeVariable <?> &&
986- !satisfiesTypeParameter (argType ,
986+ !isApplicableToTypeParameter (argType ,
987987 (TypeVariable <?>) paramBoundTypes [i ], typeBounds )) return false ;
988- else if (satisfies (new Type [] { argType }, new Type [] {
988+ else if (isApplicable (new Type [] { argType }, new Type [] {
989989 paramBoundTypes [i ] }, typeBounds ) != -1 ) return false ;
990990 }
991991 }
992992 }
993993 return true ;
994994 }
995995
996- private static boolean satisfiesWildcardType (final Type arg ,
996+ private static boolean isApplicableToWildcardType (final Type arg ,
997997 final WildcardType param )
998998 {
999999 final Type [] upperBounds = param .getUpperBounds ();
@@ -1013,7 +1013,7 @@ private static boolean satisfiesWildcardType(final Type arg,
10131013 return true ;
10141014 }
10151015
1016- private static boolean satisfiesGenericArrayType (final Type arg ,
1016+ private static boolean isApplicableToGenericArrayType (final Type arg ,
10171017 final GenericArrayType param ,
10181018 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
10191019 {
@@ -1026,15 +1026,15 @@ private static boolean satisfiesGenericArrayType(final Type arg,
10261026 final ParameterizedType argType = (ParameterizedType ) argComponent ;
10271027 final ParameterizedType paramType = (ParameterizedType ) paramComponent ;
10281028
1029- if (!satisfiesParameterizedTypes (argType , paramType , typeBounds ))
1029+ if (!isApplicableToParameterizedTypes (argType , paramType , typeBounds ))
10301030 return false ;
10311031 }
10321032
10331033 else if (paramComponent instanceof TypeVariable ) {
10341034 // TODO are these casts safe?
10351035 final TypeVariable <?> paramType = (TypeVariable <?>) paramComponent ;
10361036
1037- if (!satisfiesTypeVariable (argComponent , paramType , typeBounds ))
1037+ if (!isApplicableToTypeVariable (argComponent , paramType , typeBounds ))
10381038 return false ;
10391039 }
10401040
0 commit comments