On 2018-03-14T10:55:54 -0400
Brian Goetz <brian.go...@oracle.com> wrote:
>
> The constructor syntax
> 
>      record Point(int x, int y) {
>          Point {
>          }
>      }
> 
> is proposed as a shorthand for an explicit default constructor:
> 
>      record Point(int x, int y) {
>          Point(int x, int y) {
>          }
>      }
> 

One small thing: Could the contents of this constructor be lifted into
JavaDoc? The fact that preconditions are supposed to appear in
documentation is something that seems to be sadly lacking in almost all
of the "design by contract" systems for Java. If I write a constructor
like:

 record Point(int x, int y) {
   Point {
     Preconditions.mustBeNonNegative(x);
     Preconditions.mustBeNonNegative(y);  
   }
 }

It'd be nice if those statements could be made visible in the JavaDoc.

I think this was covered slightly in some of the other discussion about
"requires", but it fizzled out (unless I missed something).

-- 
Mark Raynsford | http://www.io7m.com

Reply via email to