RFR: 8292275: javac does not emit SYNTHETIC and MANDATED flags for parameters by default [v7]

Hannes Greule duke at openjdk.org
Thu Mar 23 13:17:18 UTC 2023


> 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.

Hannes Greule 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 26 additional commits since the last revision:

 - Merge pull request #1 from liachmodded/methodparameters-flags
   
 - Update tests
 - Parity for the parameter flag tests in javac and reflection
 - Updated RequiredMethodParameterFlagTest, checks against Local classes as well
 - Merge branch 'master' into methodparameters-flags
 - Update copyright year
 - Merge remote-tracking branch 'upstream/master' into fix/enforce-methodparam_attr-if-mandated
 - address comments
 - cleanup
 - add annotation processing test
 - ... and 16 more: https://git.openjdk.org/jdk/compare/d2710c36...5ac3a214

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/9862/files
  - new: https://git.openjdk.org/jdk/pull/9862/files/43780935..5ac3a214

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=9862&range=06
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=9862&range=05-06

  Stats: 480788 lines in 5885 files changed: 270818 ins; 148305 del; 61665 mod
  Patch: https://git.openjdk.org/jdk/pull/9862.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/9862/head:pull/9862

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


More information about the compiler-dev mailing list