@@ -280,8 +280,7 @@ public static Type greatestCommonSuperType(Type[] types,
280
280
final boolean wildcardSingleIface )
281
281
{
282
282
283
- types = Arrays .stream (types ).filter (t -> !(t .equals (Any .class ) ||
284
- t instanceof Any )).toArray (Type []::new );
283
+ types = Arrays .stream (types ).filter (t -> !(Any .is (t ))).toArray (Type []::new );
285
284
286
285
// return answer quick if the answer is trivial
287
286
if (types .length == 0 ) return null ;
@@ -679,7 +678,7 @@ public static boolean typesSatisfyVariables(
679
678
private static boolean isApplicableToRawTypes (final Type arg ,
680
679
final Type param )
681
680
{
682
- if (arg instanceof Any || arg . equals ( Any . class )) return true ;
681
+ if (Any . is ( arg )) return true ;
683
682
final List <Class <?>> srcClasses = Types .raws (arg );
684
683
final List <Class <?>> destClasses = Types .raws (param );
685
684
for (final Class <?> destClass : destClasses ) {
@@ -729,7 +728,7 @@ private static boolean isApplicableToParameterizedTypes(final Type arg,
729
728
if (destType instanceof TypeVariable <?>) {
730
729
final Type srcType = srcTypes [i ];
731
730
final TypeVariable <?> destTypeVar = (TypeVariable <?>) destType ;
732
- if (srcType instanceof Any || srcType . equals ( Any . class )) continue ;
731
+ if (Any . is ( srcType )) continue ;
733
732
if (!isApplicableToTypeParameter (srcType , destTypeVar , typeBounds ))
734
733
return false ;
735
734
ignoredIndices .add (i );
@@ -1674,7 +1673,7 @@ private static boolean isAssignable(final Type type, final Type toType,
1674
1673
return isAssignable (type , (TypeVariable <?>) toType , typeVarAssigns );
1675
1674
}
1676
1675
1677
- if (toType instanceof Any ) {
1676
+ if (Any . is ( toType ) ) {
1678
1677
return isAssignable (type , (Any ) toType , typeVarAssigns );
1679
1678
}
1680
1679
@@ -1787,7 +1786,7 @@ private static boolean isAssignable(final Type type,
1787
1786
return false ;
1788
1787
}
1789
1788
1790
- if (type instanceof Any ) return true ;
1789
+ if (Any . is ( type ) ) return true ;
1791
1790
1792
1791
throw new IllegalStateException ("found an unhandled type: " + type );
1793
1792
}
@@ -1941,9 +1940,7 @@ else if (!isAssignable(fromResolved == null ? fromTypeArg
1941
1940
// parameters of the target type.
1942
1941
if (fromResolved != null && !fromResolved .equals (toResolved )) {
1943
1942
// check for anys
1944
- if (fromResolved instanceof Any || toResolved instanceof Any ||
1945
- fromResolved .equals (Any .class ) || toResolved .equals (Any .class ))
1946
- continue ;
1943
+ if (Any .is (fromResolved ) || Any .is (toResolved )) continue ;
1947
1944
if (fromResolved instanceof ParameterizedType &&
1948
1945
toResolved instanceof ParameterizedType )
1949
1946
{
@@ -1961,9 +1958,7 @@ else if (!isAssignable(fromResolved == null ? fromTypeArg
1961
1958
typeVarAssigns .put ((TypeVariable <?>) toTypes [i ], fromTypes [i ]);
1962
1959
continue ;
1963
1960
}
1964
- if (!(fromTypes [i ] instanceof Any || toTypes [i ] instanceof Any ||
1965
- fromTypes [i ].equals (Any .class ) || toTypes [i ].equals (Any .class )))
1966
- return false ;
1961
+ if (!(Any .is (fromTypes [i ]) || Any .is (toTypes [i ]))) return false ;
1967
1962
}
1968
1963
continue ;
1969
1964
}
@@ -2131,7 +2126,7 @@ private static boolean isAssignable(final Type type,
2131
2126
final GenericArrayType toGenericArrayType ,
2132
2127
final Map <TypeVariable <?>, Type > typeVarAssigns )
2133
2128
{
2134
- if (type == null || type instanceof Any || type . equals ( Any . class )) {
2129
+ if (type == null || Any . is ( type )) {
2135
2130
return true ;
2136
2131
}
2137
2132
@@ -2211,7 +2206,7 @@ private static boolean isAssignable(final Type type,
2211
2206
final WildcardType toWildcardType ,
2212
2207
final Map <TypeVariable <?>, Type > typeVarAssigns )
2213
2208
{
2214
- if (type == null || type instanceof Any || type . equals ( Any . class )) {
2209
+ if (type == null || Any . is ( type )) {
2215
2210
return true ;
2216
2211
}
2217
2212
@@ -2355,7 +2350,7 @@ private static boolean isAssignable(final Type type,
2355
2350
return true ;
2356
2351
}
2357
2352
2358
- if (type instanceof Any || type . equals ( Any . class )) {
2353
+ if (Any . is ( type )) {
2359
2354
typeVarAssigns .put (toTypeVariable , new Any (toTypeVariable .getBounds ()));
2360
2355
return true ;
2361
2356
}
@@ -3496,7 +3491,7 @@ private static String toString(final Type type, final Set<Type> done) {
3496
3491
if (type instanceof Class ) {
3497
3492
return classToString ((Class <?>) type , done );
3498
3493
}
3499
- if (type instanceof Any ) {
3494
+ if (Any . is ( type ) ) {
3500
3495
return type .toString ();
3501
3496
}
3502
3497
if (type instanceof ParameterizedType ) {
0 commit comments