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

Vicente Romero vromero at openjdk.org
Wed Oct 19 04:57:44 UTC 2022


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

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

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

Changes: https://git.openjdk.org/jdk/pull/10756/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10756&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8291914
  Stats: 9 lines in 4 files changed: 2 ins; 0 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/10756.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10756/head:pull/10756

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


More information about the compiler-dev mailing list