On Mon, 24 Apr 2023 16:27:28 GMT, ExE Boss <d...@openjdk.org> wrote: > Note that other `*Impl` classes in `java.lang.constant` perform validation in > their constructors and provide custom `toString()` formatting and they also > don’t use records.
Records were only added in Java 16; the constant API was added in 12, so this is not a reason not to use records. But performing validation in constructors is better than in factory methods, to avoid code paths that potentially create invalid instances. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13615#issuecomment-1520491520