-
Bug
-
Resolution: Fixed
-
P4
-
14, 16, 18
-
b16
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8274476 | 17.0.2 | Robo Duke | P4 | Resolved | Fixed | b01 |
ADDITIONAL SYSTEM INFORMATION :
System:
Linux 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64
OS:
Fedora 34 in WSL
Java runtime:
openjdk version "16.0.2" 2021-07-20
OpenJDK Runtime Environment 21.3 (build 16.0.2+7)
OpenJDK 64-Bit Server VM 21.3 (build 16.0.2+7, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
When a generated class is used as type of a record's property, compilation fails with the following stacktrace:
java.lang.AssertionError: typeSig ERROR
at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:5168)
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.putDescriptor(PoolWriter.java:139)
at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter.putDescriptor(PoolWriter.java:146)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeRecordAttribute(ClassWriter.java:852)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1650)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1504)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:757)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1644)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1612)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
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)
It cannot be reproduced by just annotation a random class with @Generated and doesn't happen when replacing the stub with the full generated class and removing code generation altogether
Hard to tell if it's immutables in the wrong or not, so here goes as per the error message's recommendation
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Given the following interface (using https://immutables.github.io/ ):
@Immutable
public interface SomeImmutable {}
Using the generated concrete class as a record property as such:
public record SomeRecord(
ImmutableSomeImmutable someImmutable
) { }
Full reproduction sample at https://github.com/Tristan971/javac-typesig-error
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Successful compilation
ACTUAL -
java.lang.AssertionError: typeSig ERROR
at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:5168)
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.putDescriptor(PoolWriter.java:139)
at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter.putDescriptor(PoolWriter.java:146)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeRecordAttribute(ClassWriter.java:852)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1650)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1504)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:757)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1644)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1612)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
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 ----------
@Immutable
public interface SomeImmutable {}
public record SomeRecord(
ImmutableSomeImmutable someImmutable
) { }
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Not using an immutables-generated class as a record property type
FREQUENCY : always
System:
Linux 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64
OS:
Fedora 34 in WSL
Java runtime:
openjdk version "16.0.2" 2021-07-20
OpenJDK Runtime Environment 21.3 (build 16.0.2+7)
OpenJDK 64-Bit Server VM 21.3 (build 16.0.2+7, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
When a generated class is used as type of a record's property, compilation fails with the following stacktrace:
java.lang.AssertionError: typeSig ERROR
at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:5168)
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.putDescriptor(PoolWriter.java:139)
at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter.putDescriptor(PoolWriter.java:146)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeRecordAttribute(ClassWriter.java:852)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1650)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1504)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:757)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1644)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1612)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
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)
It cannot be reproduced by just annotation a random class with @Generated and doesn't happen when replacing the stub with the full generated class and removing code generation altogether
Hard to tell if it's immutables in the wrong or not, so here goes as per the error message's recommendation
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Given the following interface (using https://immutables.github.io/ ):
@Immutable
public interface SomeImmutable {}
Using the generated concrete class as a record property as such:
public record SomeRecord(
ImmutableSomeImmutable someImmutable
) { }
Full reproduction sample at https://github.com/Tristan971/javac-typesig-error
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Successful compilation
ACTUAL -
java.lang.AssertionError: typeSig ERROR
at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:5168)
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.putDescriptor(PoolWriter.java:139)
at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter.putDescriptor(PoolWriter.java:146)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeRecordAttribute(ClassWriter.java:852)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1650)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1504)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:757)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1644)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1612)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
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 ----------
@Immutable
public interface SomeImmutable {}
public record SomeRecord(
ImmutableSomeImmutable someImmutable
) { }
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Not using an immutables-generated class as a record property type
FREQUENCY : always
- backported by
-
JDK-8274476 java.lang.AssertionError: typeSig ERROR on generated class property of record
-
- Resolved
-
- relates to
-
JDK-8297831 typeSig ERROR for generated class field of a record (not a duplicate)
-
- Closed
-
-
JDK-8284255 AssertionError: typeSig ERROR on record property with generated class type arg
-
- Closed
-
- links to
-
Commit openjdk/jdk17u/dd705127
-
Commit openjdk/jdk/e07ab82e
-
Review openjdk/jdk17u/107
-
Review openjdk/jdk/5511
(2 links to)