Received on the -comments list. A similar comment was made in the comments of this SO issue: https://stackoverflow.com/questions/64131753/why-is-the-variable-arity-record-component-not-inferred-with-custom-constructor
-------- Forwarded Message -------- Subject: Records feedback Date: Thu, 1 Oct 2020 15:09:38 -0500 From: David Aaron Kaye <kayed...@gmail.com> To: java-se-spec-comme...@openjdk.java.net Good afternoon, I am very excited to see Records coming to Java. I have been playing around with them since JDK 14. I noticed that in the proposal, JDK-8246771 <https://bugs.openjdk.java.net/browse/JDK-8246771>, it says ...if the canonical constructor is explicitly declared then its access modifier must provide at least as much access as the record class I have implemented a functional List: public sealed interface List<A> permits Cons, Nil { } public record Cons<A>(A head, List<A> tail) implements List<A> { } @SuppressWarnings("rawtypes") public record Nil<Nothing>() implements List<Nothing> { public static final Nil instance = new Nil(); private Nil() { } } I made the constructor private because I want this to be a singleton, accessed from instance, but the current proposal does not allow me to do that, and I get a compilation error on the private constructor. I could prefer to be able to make the constructor private so that I can have a record that is a singleton. Thanks, David Kaye