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

Lambdas containing inner classes referencing external type variables do not correctly parameterize the inner class

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b82
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      Below is a portion of such a class file (source attached). Note paramterized field but no parameter on class.:

      Classfile /home/robert/work/try/tv/src/TV$1.class
        Last modified Jan 2, 2013; size 532 bytes
        MD5 checksum 2cc5fa9202a02a874483b46b9c1984f5
        Compiled from "TV.java"
      class TV$1 extends C
        SourceFile: "TV.java"
        EnclosingMethod: #23.#24 // TV.lambda$0
        InnerClasses:
             #5; //class TV$1
        minor version: 0
        major version: 52
        flags: ACC_SUPER
      Constant pool:
      ...
      {
        R cr;
          Signature: Ljava/lang/Object;
          flags:
          Signature: #10 // TR;
      ...

      ----------------------------------
      This bug can also be seen by making interface I, Serializable. In that case the compiler assertion below is triggerred on compilation (assertion has been annotated to show the offending type, a type variable):
      % javac TV.java
      An exception has occurred in the compiler (1.8.0-internal). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.AssertionError: xClassName t:R
              at com.sun.tools.javac.jvm.ClassWriter.xClassName(ClassWriter.java:447)
              at com.sun.tools.javac.jvm.ClassWriter.writePool(ClassWriter.java:560)
              at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1638)
              at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1510)
              at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:753)
              at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1522)
              at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1486)
              at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:908)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:867)
              at com.sun.tools.javac.main.Main.compile(Main.java:482)
              at com.sun.tools.javac.main.Main.compile(Main.java:363)
              at com.sun.tools.javac.main.Main.compile(Main.java:352)
              at com.sun.tools.javac.main.Main.compile(Main.java:343)
              at com.sun.tools.javac.Main.compile(Main.java:76)
              at com.sun.tools.javac.Main.main(Main.java:61)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rfield Robert Field
                Reporter:
                rfield Robert Field
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: