[code-reflection] Integrated: Enable pattern matching for JavaType hierarchy

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Apr 29 09:55:17 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.

This pull request has now been integrated.

Changeset: a130820f
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/babylon/commit/a130820f1842de6b9d9256f5285128e843a77209
Stats:     99 lines in 7 files changed: 0 ins; 91 del; 8 mod

Enable pattern matching for JavaType hierarchy

Reviewed-by: psandoz

-------------

PR: https://git.openjdk.org/babylon/pull/64


More information about the babylon-dev mailing list