[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


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);
        }
    }
 ```

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

Commit messages:
 - A less clumsey way of forcing range factories

Changes: https://git.openjdk.org/babylon/pull/673/files
  Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=673&range=00
  Stats: 27 lines in 1 file changed: 8 ins; 0 del; 19 mod
  Patch: https://git.openjdk.org/babylon/pull/673.diff
  Fetch: git fetch https://git.openjdk.org/babylon.git pull/673/head:pull/673

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


More information about the babylon-dev mailing list