[code-reflection] Integrated: Clean up support for boxing
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Apr 30 17:11:13 UTC 2024
On Tue, 30 Apr 2024 11:11:42 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This PR does a couple of things:
> * it sharpens the types of the various `JavaType` constants to the correct sealed sub-interface
> * it consolidates support for boxing/unboxing. More specifically there's now a pair of functions:
>
>
> ClassType::unbox() -> Optional<PrimitiveType>
>
>
> and
>
>
> PrimitiveType::box() -> Optional<ClassType>
>
>
> Note that both functions are partial: there are classes that are not wrappers (e.g. String) and there are primitive types that cannot be boxed (e.g. `void`).
>
> I'm on the fence whether to use `Optional` for this, or just return null. Suggestions welcome.
This pull request has now been integrated.
Changeset: ac9bc55a
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.org/babylon/commit/ac9bc55a1fabfed9a7133156371b1133dfc42e4d
Stats: 100 lines in 5 files changed: 42 ins; 22 del; 36 mod
Clean up support for boxing
Reviewed-by: psandoz
-------------
PR: https://git.openjdk.org/babylon/pull/67
More information about the babylon-dev
mailing list