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.

          Activity

          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/langtools/rev/d386dce997f6
          User: jlahoda
          Date: 2014-12-17 11:55:02 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/langtools/rev/d386dce997f6 User: jlahoda Date: 2014-12-17 11:55:02 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/langtools/rev/d386dce997f6
          User: lana
          Date: 2014-12-23 22:27:35 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/langtools/rev/d386dce997f6 User: lana Date: 2014-12-23 22:27:35 +0000

            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: