[code-reflection] Integrated: A less clumsey way of forcing range factories

Gary Frost gfrost at openjdk.org
Sun Nov 9 13:03:35 UTC 2025


On Sun, 9 Nov 2025 12:58:27 GMT, Gary Frost <gfrost at openjdk.org> wrote:

> The previoust had a hack for enforcing factories.  
> 
> This is slightly cleaner. We add the factory method to an interface and offer a record implementation as an inner record. 
> 
>     interface Global1D extends  _1DX, Global{
>         record Impl(int x) implements Global1D{};
>         static Global1D of(int x) {
>             return new Impl(x);
>         }
>     }
>  ```

This pull request has now been integrated.

Changeset: 7c0350a7
Author:    Gary Frost <gfrost at openjdk.org>
URL:       https://git.openjdk.org/babylon/commit/7c0350a7eebf776ce997ab918c03426dda7c669e
Stats:     27 lines in 1 file changed: 8 ins; 0 del; 19 mod

A less clumsey way of forcing range factories

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

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


More information about the babylon-dev mailing list