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

java.lang.AssertionError: typeSig when compiling class with lombok annotation

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      jdk 17.0.5, lombok 1.8.24

      A DESCRIPTION OF THE PROBLEM :
      While compile some new code I wrote, I encountered this error. I was then able to create a simple test class to reproduce the problem.
      The problem occurs when creating a record with a property of a generic class with a class generated by lombok as type parameter.

      However, the manually delomboked test class compiles without problems.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Download lombok from https://projectlombok.org/download and compile with:
      1. javac Test.java -cp lombok.jar

      To delombok the class:
      java -jar lombok.jar delombok -p Test.java

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compiler succeeds
      ACTUAL -
      java.lang.AssertionError: typeSig ERROR
      at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:5166)
      at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter$SharedSignatureGenerator.assembleSig(PoolWriter.java:298)
      at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:5226)
      at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleClassSig(Types.java:5202)
      at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:5112)
      at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter$SharedSignatureGenerator.assembleSig(PoolWriter.java:298)
      at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter.typeSig(PoolWriter.java:492)
      at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter.putSignature(PoolWriter.java:157)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeMemberAttrs(ClassWriter.java:370)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeRecordAttribute(ClassWriter.java:856)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1651)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1505)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:738)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1617)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1585)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
      at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
      at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50)

      ---------- BEGIN SOURCE ----------
      import java.util.List;

      import lombok.Builder;

      public class Test {
      @Builder
      private static class Data {
      }

      private record Builders(List<Data.DataBuilder> builders) {
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      not using lombok

      FREQUENCY : always


        1. Test.java
          0.2 kB
          Anupam Dev

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: