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

AssertionError: typeSig ERROR on record property with generated class type arg

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      OS: Fedora 35

      Java from Fedora:
      OpenJDK Runtime Environment 21.9 (build 17.0.2+8)

      Java from jdk.java.net
      OpenJDK Runtime Environment (build 18+36-2087)
      OpenJDK Runtime Environment (build 19-ea+15-942)

      A DESCRIPTION OF THE PROBLEM :
      Similar to https://bugs.openjdk.java.net/browse/JDK-8273408 which doesn't seem to be fixed completely.

      Any record property with a generated class in the type arguments causes javac to fail, e.g. "record Many(List<ImmutableSome> values) { }", or with Optional etc.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      mvn clean compile

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      compiles successfully
      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.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
      at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
      at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
      at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
      at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
      at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)
      at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:785)
      at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
      at java.base/java.lang.reflect.Method.invoke(Method.java:577)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:47)

      ---------- BEGIN SOURCE ----------
      diff --git a/pom.xml b/pom.xml
      new file mode 100644
      index 0000000..460ead6
      --- /dev/null
      +++ b/pom.xml
      @@ -0,0 +1,26 @@
      +<?xml version="1.0" encoding="UTF-8"?>
      +<project xmlns="http://maven.apache.org/POM/4.0.0"
      + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      + <modelVersion>4.0.0</modelVersion>
      +
      + <groupId>org.example</groupId>
      + <artifactId>bug</artifactId>
      + <version>1.0-SNAPSHOT</version>
      +
      + <properties>
      + <maven.compiler.source>17</maven.compiler.source>
      + <maven.compiler.target>17</maven.compiler.target>
      + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      + </properties>
      +
      + <dependencies>
      + <dependency>
      + <groupId>org.immutables</groupId>
      + <artifactId>value</artifactId>
      + <version>2.8.8</version>
      + <optional>true</optional>
      + </dependency>
      + </dependencies>
      +
      +</project>
      diff --git a/src/main/java/Main.java b/src/main/java/Main.java
      new file mode 100644
      index 0000000..d7d9d23
      --- /dev/null
      +++ b/src/main/java/Main.java
      @@ -0,0 +1,10 @@
      +import java.util.List;
      +import org.immutables.value.Value.Immutable;
      +
      +public class Main {
      +
      + @Immutable
      + interface AbstractSome { }
      +
      + record Many(List<ImmutableSome> values) { }
      +}
      ---------- END SOURCE ----------

      FREQUENCY : always


            vromero Vicente Arturo Romero Zaldivar
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: