RFR: 8253385: annotation processors remove varargs information from record components

Vicente Romero vromero at openjdk.java.net
Fri Oct 16 20:02:19 UTC 2020

Please review this fix for a corner case bug. Essentially for code like:

import java.lang.annotation.*;

@interface Simple {}

record R(@Simple int ...val) {
    static void test() {
        R rec = new R(10, 20);

assuming that there is an AP present, after the first annotation processing round, the record component's symbol is set
to `null` and thus the flags info is lost. So once the symbols and their types are determined again after every
annotation processing round, there is no recollection that the record component was a varargs. Remember that the AST
for the record component declaration is not kept but it is used to extract information from it and to derive compiler
generated code like fields, canonical constructor, etc. The proposed solution is to keep the information about the
vararg-ness of the record component in a dedicated field in the record component so that this information can be
recovered later on as needed.



Commit messages:
 - 8253385: annotation processors remove varargs information from record components

Changes: https://git.openjdk.java.net/jdk/pull/709/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=709&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8253385
  Stats: 44 lines in 2 files changed: 43 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/709.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/709/head:pull/709

PR: https://git.openjdk.java.net/jdk/pull/709

More information about the compiler-dev mailing list