bito-code-review[bot] commented on PR #15732:
URL: https://github.com/apache/grails-core/pull/15732#issuecomment-4699014040
<!-- Bito Reply -->
Using `value?.class?.isAssignableFrom` is not necessary here because the
code already resolves the type and uses `isInstance` to check compatibility.
The current implementation `resolvedType.isInstance(value)` is the standard,
idiomatic way to check if an object is an instance of a specific class in
Java/Groovy, and it correctly handles `null` values (returning `false`).
**grails-web-core/src/main/groovy/org/grails/web/servlet/HttpServletRequestExtension.groovy**
```
Object value = request.getAttribute(name)
Class<T> resolvedType = (Class<T>)
ClassUtils.resolvePrimitiveIfNecessary(type)
resolvedType.isInstance(value) ? resolvedType.cast(value) : null
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]