-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
The ResolvableType.isAssignableFrom
algorithm performs a regular matching attempt for nested array component types, including the lenient matching of primitive types versus primitive wrapper types, e.g. considering Integer[]
and int[]
as assignable. Since the Java compiler matches array components in a strict fashion for assignments, ResolvableType
needs to align with this, not expecting any remaining conversion to be performed between primitive and wrapper types after an assignability check.
This brings ResolvableType.isAssignableFrom
in line with Class.isAssignableFrom
, consistently answering true
whenever two Class
references wrapped within ResolvableType
get compared just like when they get compared via Class.isAssignableFrom
itself. Most importantly, this allows for a significant optimization in that we can actually delegate to Class.isAssignableFrom
whenever two Class-based ResolvableType
instances get compared, speeding up such checks by 5x. The full algorithm is only applied when actual generics are involved.