RFR: 8253385: annotation processors remove varargs information from record components [v3]
Vicente Romero
vromero at openjdk.java.net
Wed Nov 4 18:21:15 UTC 2020
> Please review this fix for a corner case bug. Essentially for code like:
>
> import java.lang.annotation.*;
>
> @Target({ElementType.TYPE_USE})
> @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.
>
> TIA,
> Vicente
Vicente Romero has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
- Merge branch 'master' into JDK-8253385
- addressing review comments
- 8253385: annotation processors remove varargs information from record components
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/709/files
- new: https://git.openjdk.java.net/jdk/pull/709/files/21e26551..787196a2
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=709&range=02
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=709&range=01-02
Stats: 91449 lines in 1574 files changed: 64459 ins; 19529 del; 7461 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