Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: P3
    • Resolution: Delivered
    • Affects Version/s: 11, 12, 13
    • Fix Version/s: 13
    • Component/s: tools

      Description

      If an anonymous or local inner class is declared inside of a lambda, the `EnclosingMethod` attribute on that class refers to the synthetic lambda method rather than to the method that enclosed the original declaration. The original method should be considered as the closest lexically enclosing method.

      The proposed solution to this issue is to point the `EnclosingMethod` attribute of inner classes declared inside a lambda to the original enclosing method. The Java compiler was updated, so that the `EnclosingMethod` attribute of anonymous or local inner classes declared inside a lambda point to the method enclosing the declaration.

      The following is the related section in the Java Language Specification:
      JVMS 11 4.7.7: It is the responsibility of a Java compiler to ensure that the method identified via the method_index is indeed the closest lexically enclosing method of the class that contains this `EnclosingMethod` attribute.

        Attachments

          Activity

            People

            • Assignee:
              vromero Vicente Arturo Romero Zaldivar
              Reporter:
              vromero Vicente Arturo Romero Zaldivar
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: