Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8183548

Comma-expressions shouldn't use any temporary variable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 10
    • Fix Version/s: 12
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b12

      Description

      Comma-expressions shouldn't use any temporary variable. For example, the boxed post-incrementation (this.i++) is actually translated as follows:

      (let /*synthetic*/ final Integer $5222779 = (Integer)this.i in
          (let /*synthetic*/ final Integer $18695331 = this.i = Integer.valueOf((int)(this.i.intValue() + 1)) in
              $5222779));

      Creating a temporary variable $18695331 is useless and should be avoided (it's never used and immediately discarded).

      To achieve this goal, let-expressions have to be refactored to allow more than one statement, probably in the form of block-expressions to give even more freedom.

      Comma-expressions (see Lower.makeComma()) could then be translated naturally without any temporary variable.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bsrbnd Bernard Blaser
                Reporter:
                bsrbnd Bernard Blaser
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: