@@ -793,14 +793,14 @@ public static boolean isInstance(final Object obj, final Class<?> dest) {
793793 * @return -1 if the args satisfy the params, otherwise the index of the arg
794794 * that does not satisfy its parameter.
795795 */
796- public static int satisfies (final Type [] args , final Type [] params ) {
796+ public static int isApplicable (final Type [] args , final Type [] params ) {
797797 // create a HashMap to monitor the restrictions of the type variables.
798798 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds = new HashMap <>();
799799
800- return satisfies (args , params , typeBounds );
800+ return isApplicable (args , params , typeBounds );
801801 }
802802
803- public static int satisfies (final Type [] args , final Type [] params ,
803+ public static int isApplicable (final Type [] args , final Type [] params ,
804804 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
805805 {
806806 if (args .length != params .length ) {
@@ -811,21 +811,21 @@ public static int satisfies(final Type[] args, final Type[] params,
811811 Type arg = args [i ];
812812 Type param = params [i ];
813813 // First, check raw type assignability.
814- if (!satisfiesRawTypes (arg , param )) return i ;
814+ if (!isApplicableToRawTypes (arg , param )) return i ;
815815
816816 if (param instanceof ParameterizedType ) {
817- if (!satisfiesParameterizedTypes (arg , (ParameterizedType ) param ,
817+ if (!isApplicableToParameterizedTypes (arg , (ParameterizedType ) param ,
818818 typeBounds )) return i ;
819819 }
820820 else if (param instanceof TypeVariable ) {
821- if (!satisfiesTypeVariable (arg , (TypeVariable <?>) param ,
821+ if (!isApplicableToTypeVariable (arg , (TypeVariable <?>) param ,
822822 typeBounds )) return i ;
823823 }
824824 else if (param instanceof WildcardType ) {
825- if (!satisfiesWildcardType (arg , (WildcardType ) param )) return i ;
825+ if (!isApplicableToWildcardType (arg , (WildcardType ) param )) return i ;
826826 }
827827 else if (param instanceof GenericArrayType ) {
828- if (!satisfiesGenericArrayType (arg , (GenericArrayType ) param ,
828+ if (!isApplicableToGenericArrayType (arg , (GenericArrayType ) param ,
829829 typeBounds )) return i ;
830830 }
831831 final Type t = TypeToken .of (param ).resolveType (arg ).getType ();
@@ -834,13 +834,13 @@ else if (param instanceof GenericArrayType) {
834834 return -1 ;
835835 }
836836
837- public static boolean satisfies (
837+ public static boolean typesSatisfyVariables (
838838 final Map <TypeVariable <?>, Type > typeVarAssigns )
839839 {
840840 return TypeUtils .typesSatisfyVariables (typeVarAssigns );
841841 }
842842
843- private static boolean satisfiesRawTypes (final Type arg , final Type param ) {
843+ private static boolean isApplicableToRawTypes (final Type arg , final Type param ) {
844844 final List <Class <?>> srcClasses = Types .raws (arg );
845845 final List <Class <?>> destClasses = Types .raws (param );
846846 for (final Class <?> destClass : destClasses ) {
@@ -853,7 +853,7 @@ private static boolean satisfiesRawTypes(final Type arg, final Type param) {
853853 return true ;
854854 }
855855
856- private static boolean satisfiesParameterizedTypes (final Type arg ,
856+ private static boolean isApplicableToParameterizedTypes (final Type arg ,
857857 final ParameterizedType param ,
858858 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
859859 {
@@ -883,15 +883,15 @@ private static boolean satisfiesParameterizedTypes(final Type arg,
883883 if (destType instanceof TypeVariable <?>) {
884884 final Type srcType = srcTypes [i ];
885885 final TypeVariable <?> destTypeVar = (TypeVariable <?>) destType ;
886- if (!satisfiesTypeParameter (srcType , destTypeVar , typeBounds ))
886+ if (!isApplicableToTypeParameter (srcType , destTypeVar , typeBounds ))
887887 return false ;
888888 ignoredIndices .add (i );
889889 }
890890 }
891891 srcTypes = filterIndices (srcTypes , ignoredIndices );
892892 destTypes = filterIndices (destTypes , ignoredIndices );
893893 // recursively run satisfies on these arrays
894- return satisfies (srcTypes , destTypes , typeBounds ) == -1 ;
894+ return isApplicable (srcTypes , destTypes , typeBounds ) == -1 ;
895895 }
896896
897897 /**
@@ -909,7 +909,7 @@ private static boolean satisfiesParameterizedTypes(final Type arg,
909909 * @return {@code boolean} - true if the replacement of {@code param} with
910910 * {@code arg} is allowed.
911911 */
912- private static boolean satisfiesTypeParameter (final Type arg ,
912+ private static boolean isApplicableToTypeParameter (final Type arg ,
913913 final TypeVariable <?> param ,
914914 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
915915 {
@@ -928,11 +928,11 @@ private static boolean satisfiesTypeParameter(final Type arg,
928928 // if the type variable refers to some parameterized type (e.g. T extends
929929 // List<?>), call satisfiesTypeParameters on the bounds of param that
930930 // are ParameterizedTypes.
931- if (!satisfiesTypeVariableBounds (arg , param , typeBounds )) return false ;
931+ if (!isApplicableToTypeVariableBounds (arg , param , typeBounds )) return false ;
932932 return true ;
933933 }
934934
935- private static boolean satisfiesTypeVariable (final Type arg ,
935+ private static boolean isApplicableToTypeVariable (final Type arg ,
936936 final TypeVariable <?> param ,
937937 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
938938 {
@@ -949,7 +949,7 @@ private static boolean satisfiesTypeVariable(final Type arg,
949949 // if the type variable refers to some parameterized type (e.g. T extends
950950 // List<?>), call satisfiesTypeParameters on the bounds of param that
951951 // are ParameterizedTypes.
952- if (!satisfiesTypeVariableBounds (arg , param , typeBounds )) return false ;
952+ if (!isApplicableToTypeVariableBounds (arg , param , typeBounds )) return false ;
953953 return true ;
954954 }
955955
@@ -966,7 +966,7 @@ private static boolean satisfiesTypeVariable(final Type arg,
966966 * @return {@code boolean} - true if {@code arg} can satisfy the bounds of
967967 * {@code param}.
968968 */
969- private static boolean satisfiesTypeVariableBounds (final Type arg ,
969+ private static boolean isApplicableToTypeVariableBounds (final Type arg ,
970970 final TypeVariable <?> param ,
971971 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
972972 {
@@ -985,17 +985,17 @@ private static boolean satisfiesTypeVariableBounds(final Type arg,
985985 return false ;
986986 }
987987 if (paramBoundTypes [i ] instanceof TypeVariable <?> &&
988- !satisfiesTypeParameter (argType ,
988+ !isApplicableToTypeParameter (argType ,
989989 (TypeVariable <?>) paramBoundTypes [i ], typeBounds )) return false ;
990- else if (satisfies (new Type [] { argType }, new Type [] {
990+ else if (isApplicable (new Type [] { argType }, new Type [] {
991991 paramBoundTypes [i ] }, typeBounds ) != -1 ) return false ;
992992 }
993993 }
994994 }
995995 return true ;
996996 }
997997
998- private static boolean satisfiesWildcardType (final Type arg ,
998+ private static boolean isApplicableToWildcardType (final Type arg ,
999999 final WildcardType param )
10001000 {
10011001 final Type [] upperBounds = param .getUpperBounds ();
@@ -1015,7 +1015,7 @@ private static boolean satisfiesWildcardType(final Type arg,
10151015 return true ;
10161016 }
10171017
1018- private static boolean satisfiesGenericArrayType (final Type arg ,
1018+ private static boolean isApplicableToGenericArrayType (final Type arg ,
10191019 final GenericArrayType param ,
10201020 final HashMap <TypeVariable <?>, TypeVarInfo > typeBounds )
10211021 {
@@ -1028,15 +1028,15 @@ private static boolean satisfiesGenericArrayType(final Type arg,
10281028 final ParameterizedType argType = (ParameterizedType ) argComponent ;
10291029 final ParameterizedType paramType = (ParameterizedType ) paramComponent ;
10301030
1031- if (!satisfiesParameterizedTypes (argType , paramType , typeBounds ))
1031+ if (!isApplicableToParameterizedTypes (argType , paramType , typeBounds ))
10321032 return false ;
10331033 }
10341034
10351035 else if (paramComponent instanceof TypeVariable ) {
10361036 // TODO are these casts safe?
10371037 final TypeVariable <?> paramType = (TypeVariable <?>) paramComponent ;
10381038
1039- if (!satisfiesTypeVariable (argComponent , paramType , typeBounds ))
1039+ if (!isApplicableToTypeVariable (argComponent , paramType , typeBounds ))
10401040 return false ;
10411041 }
10421042
0 commit comments