Exploratory proposal: First-class namespace construct for data-oriented / functional Java

Mahied Maruf contact at mechite.com
Fri Feb 13 19:12:21 UTC 2026


Just to say that this has definitely been thought of, debated, etc.

Another good reference is Lombok's `@UtilityClass`.
> https://projectlombok.org/features/experimental/UtilityClass
> Experimental because:
> Some debate as to whether it's common enough to count as boilerplate.

I consider it to be pretty bad especially when you start to introduce
state with (implicitly static) fields in the namespace, where it can
introduce a lot of confusion / mental overhead compared to just being
happy with the `static` modifier.

I feel like it could be acceptable if it was entirely stateless, to
discourage (well, prevent) people from using this, then needing to make
their system stateful, and abusing that to maintain ABI compatibility.

Just seems like it doesn't introduce anything useful except syntactical
variances and potentially adds pitfalls.  At least I'd be much more
interested in top-level package-private implicitly-imported
stateless/static methods, if they have or ever could be considered,
because the "compact source file" feature already fits with that
syntactically.

It would be great sugar for "utility classes" that tend to not be
public API, and not remove the "discoverability" of most public API
which we get from the explicit "namespacing" that static methods in
classes,interfaces,etc offers.  Would be great to hear thoughts.

        Mahied Maruf


More information about the amber-dev mailing list