RFR: 8291914: generated constructors are considered compact when they shouldn't

Joe Darcy darcy at openjdk.org
Wed Oct 19 05:06:44 UTC 2022


On Wed, 19 Oct 2022 04:52:29 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> javac is considering all record generated constructors as compact constructors. According to the spec compact constructors should be declared explicitly. This constructor is compact:
> 
> record R1(int i) {
>     R1 {}
> }
> 
> here there is no explicit constructor so the compiler is providing one but it shouldn't be considered a compact constructor:
> 
> record R2(int i) {}
> 
> this PR is fixing the current compiler bug so that for declarations like record R2 the compiler generated constructor is not considered a compact one.
> 
> TIA

Test changes look good.

-------------

Marked as reviewed by darcy (Reviewer).

PR: https://git.openjdk.org/jdk/pull/10756


More information about the compiler-dev mailing list