Draft JLS spec for records

Brian Goetz brian.goetz at oracle.com
Thu Sep 5 22:29:14 UTC 2019

> from the same mail:
> "the canonical constructor should follow the same rule as the default constructor".

This isn't an obviously terrible idea, but it's also not a very 
important distinction, because the difference isn't observable -- if the 
class isn't accessible to the caller, they still can't invoke the 
constructor.  And it does have additional complexity, and leaves users 
in a position of guessing what the accessibility should be if they 
implement the methods explicitly.  Do you have a reason for preferring 
this additional complexity, other than "for consistency"?  (And why 
would we do it differently for the constructor than for the accessors?  
That's just pure accidental complexity.)

> and you have not answer to:
> Also why having the constructor public helps to make the record instantiatable, a constructor to be accessible by reflection requires that both the class and the constructor to be public. So following your point, does it means that all record have to be public too ?

You're still not being very clear, but it sounds like this was answered 
in the paragraph above?

More information about the amber-spec-observers mailing list