RFR: 8292275: javac does not emit SYNTHETIC and MANDATED flags for parameters by default
Hannes Greule
duke at openjdk.org
Fri Aug 12 20:22:17 UTC 2022
With this change, javac emits the MethodParameters attribute in cases where the JLS requires the information about synthetic and mandated parameters to be stored (see issue).
Parameter names are *not* emitted unless the `-parameter` flag is set.
The relevant changes are in `ClassWriter`, where we go through the params to see if we need the attribute if the `-parameter` flag is not set (if it is set, both names and flags will be emitted).
For records, the mandated flag wasn't set at all, this is solved by the one line fix in `JavacParser`.
The changes to `CreateSymbols` and `ClassReader` are needed as they weren't able to deal with missing names in the attribute.
I also had to update some tests as they got a new constant pool entry.
Only the mandated flag is covered by tests at the moment, as the occurrences are well-specified in the JLS.
Please let me know if you want tests for specific appearances of synthetic parameters.
-------------
Commit messages:
- remove spaces from empty lines in text block
- add bug number to test
- copyright
- update constant pool indexes in AnnoTest
- set mandated flag for parameters of compact constructor
- add javac testcase for implicit parameters
- combine parameter names from LVT and MethodParameters
- also require flags for synthetic
- revert valueOf hack
- adapt change to constant pool in test
- ... and 4 more: https://git.openjdk.org/jdk/compare/9f8cc421...c9ba84c7
Changes: https://git.openjdk.org/jdk/pull/9862/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9862&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8292275
Stats: 316 lines in 7 files changed: 210 ins; 23 del; 83 mod
Patch: https://git.openjdk.org/jdk/pull/9862.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/9862/head:pull/9862
PR: https://git.openjdk.org/jdk/pull/9862
More information about the compiler-dev
mailing list