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

Lambda method names are unnecessarily unstable

    Details

    • Subcomponent:
    • Resolved In Build:
      b44
    • Verification:
      Verified

      Backports

        Description

        Currently, when lambda names (for non-serializable lambdas) are generated, the exact name depends on the number of (non-serializable) lamdbas generated so far by the current javac instance. The reason is that the counter for lambda names is not per-file, but per-javac instance. For example, consider:
        public class L1 {
            private Runnable r = () -> { };
        }
        public class L2 {
            private Runnable r = () -> { };
        }
        doing:
        javac L1.java L2.java
        will make L1's lambda use lambda$new$0 and L2's lambda$new$1, while:
        javac L2.java L1.java
        will lead to the opposite name assignment.

        The problem seems to be simple: LambdaToMethod.LambdaAnalyzerPreprocessor.lambdaCount is not reset before starting with a new top-level.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jlahoda Jan Lahoda
                  Reporter:
                  jlahoda Jan Lahoda
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: