RFR: 8295184: Printing messages with a RecordComponentElement does not include position
Srikanth Adayapalam
sadayapalam at openjdk.org
Mon Dec 5 12:51:06 UTC 2022
On Mon, 5 Dec 2022 11:57:36 GMT, Srikanth Adayapalam <sadayapalam at openjdk.org> wrote:
> Stash away a copy of the record component declaration from the header for use in diagnostics
At the moment, Record components as modelled by Javac do not have a backing AST. The record header declaration which according to JLS actually declares the record components, is folded into the private field declarations. When an annotation processor wants to print a message involving a record component, this becomes a blocker.
The present PR solves this problem by building upon what javac already does - for various reasons javac squirrels away the full list of annotations applied to a record component in the field originalAnnos of RecordComponent. Rather than just save away annotations alone, the present fix stashes away the entire AST, so this can be surfaced when required.
-------------
PR: https://git.openjdk.org/jdk/pull/11511
More information about the compiler-dev
mailing list