8280035: Use Class.isInstance instead of Class.isAssignableFrom where applicable

Reviewed-by: prr, rriggs
This commit is contained in:
Andrey Turbanov 2022-05-19 21:43:32 +00:00
parent 9f562ef754
commit de74e0e25a
10 changed files with 22 additions and 25 deletions

View file

@ -481,7 +481,7 @@ public class AccessibleObject implements AnnotatedElement {
}
// if this object is an instance member, the given object
// must be a subclass of the declaring class of this reflected object
if (!declaringClass.isAssignableFrom(obj.getClass())) {
if (!declaringClass.isInstance(obj)) {
throw new IllegalArgumentException("object is not an instance of "
+ declaringClass.getName());
}