Some minor cleanups for TypeParameterMatcher (#11286)

Motivation:

The code in TypeParamterMatcher can be simplified and cleaned up.

Modification:

Cleanup

Result:

Cleanup
This commit is contained in:
terrarier2111 2021-05-27 09:02:29 +02:00 committed by GitHub
parent 84826a4ea6
commit b646a2670a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,18 +119,17 @@ public abstract class TypeParameterMatcher {
if (actualTypeParam instanceof TypeVariable) {
// Resolved type parameter points to another type parameter.
TypeVariable<?> v = (TypeVariable<?>) actualTypeParam;
currentClass = thisClass;
if (!(v.getGenericDeclaration() instanceof Class)) {
return Object.class;
}
currentClass = thisClass;
parametrizedSuperclass = (Class<?>) v.getGenericDeclaration();
typeParamName = v.getName();
if (parametrizedSuperclass.isAssignableFrom(thisClass)) {
continue;
} else {
return Object.class;
}
return Object.class;
}
return fail(thisClass, typeParamName);