Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8292275 javac does not emit SYNTHETIC and MANDATED flags for parameters by default
  3. JDK-8308450

Release Note: Emit `synthetic` and `mandated` Flags for Parameters by Default

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Delivered
    • P4
    • 21
    • 21
    • tools

    Description

      Prior to JDK 21, the `javac` compiler did not always mark method parameters as `synthetic` or `mandated` when applicable. Starting with JDK 21, the `javac` compiler emits the `MethodParameters` attribute in the class file when applicable. This attribute stores information on whether or not parameters are `synthetic` or `mandated`. This change applies to all release and target versions supported by `javac` since all currently supported releases and targets have the `MethodParameters` attribute defined.

      This change is justified by JLS § 13.1, in particular:

          A binary representation for a class or interface must also contain all of the following:

          [...]

          11. A construct emitted by a Java compiler must be marked as synthetic if it does not
              correspond to a construct declared explicitly or implicitly in source code, unless
              the emitted construct is a class initialization method (JVMS §2.9).
          12. A construct emitted by a Java compiler must be marked as mandated if it corresponds
              to a formal parameter declared implicitly in source code (§8.8.1, §8.8.9, §8.9.3,
              §15.9.5.1).

      Attachments

        Activity

          People

            vromero Vicente Arturo Romero Zaldivar
            vromero Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: