[code-reflection] RFR: Enable pattern matching for JavaType hierarchy
Paul Sandoz
psandoz at openjdk.org
Fri Apr 26 18:37:05 UTC 2024
On Fri, 26 Apr 2024 17:50:43 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> The `JavaType` hierarchy has now several types under it:
>
> * `ClassType`
> * `ArrayType`
> * `PrimitiveType`
> * `TypeVarRef`
> * `WildcardType`
>
> All these types are `public`, except `PrimitiveType`. This limits applicability of pattern matching.
>
> In addition, `JavaType` defines a bunch of predicates:
>
> * `isClass()`
> * `isArray()`
> * `isPrimitive()`
>
> This set of predicates is now incomplete, as it doesn't support all the possible leaves in the type hierarchy.
>
> Overall, it would be much better to just lean into pattern matching more, and drop the predicates.
Very good!
-------------
Marked as reviewed by psandoz (Lead).
PR Review: https://git.openjdk.org/babylon/pull/64#pullrequestreview-2025647502
More information about the babylon-dev
mailing list