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

Vicente Romero vromero at openjdk.org
Thu Oct 20 15:01:53 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

This pull request has now been integrated.

Changeset: 95dd376b
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/95dd376ba249b9eb8ab40a957238dfd79e60112f
Stats:     9 lines in 4 files changed: 2 ins; 0 del; 7 mod

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

Reviewed-by: darcy, jlahoda

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

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


More information about the compiler-dev mailing list