Skip to content

Classfile parser breaks on nested generics in dependency of community build #26312

Description

@starswap

Compiler version

3.8.3, also Scala 3.10.0-RC1-bin-20260609-b34a019-NIGHTLY

Minimized code

I struggled to create a minimized version which doesn't use the library but I think it should be possible with the right combination of generics.

//> using scala 3.nightly
//> using dep cc.redberry:rings:2.5.8

import cc.redberry.rings.io.Coder

def main =
  new Coder[Int, Int, Int](null, null, null, null, null)

This is the class definition from the library https://github.com/PoslavskySV/rings/blob/develop/rings/src/main/java/cc/redberry/rings/io/Coder.java.

Output

Error: error while loading Coder$1,
  class file cc/redberry/rings/io/Coder$1.class is broken (version 52.0),
  please check the JDK compatibility of your Scala version (3.10.0-RC1-bin-20260609-b34a019-NIGHTLY),
  reading aborted with class java.util.NoSuchElementException:
  key not found: Oth
[error] ./test1001.scala:7:7
[error] none of the overloaded alternatives named <init> can be accessed as a member of cc.redberry.rings.io.Coder[Int, Int, Int] from the top-level definitions in package <empty>.
[error]   private[io] constructor Coder can only be accessed from package cc.redberry.rings.io in package cc.redberry.rings.
[error]   private constructor Coder can only be accessed from class Coder in package cc.redberry.rings.io.
[error]   new Coder[Int, Int, Int](null, null, null, null, null)
[error]       ^^^^^^^^^^^^^^^^^^^^

Expectation

Only

[error] ./test1001.scala:7:7
[error] none of the overloaded alternatives named <init> can be accessed as a member of cc.redberry.rings.io.Coder[Int, Int, Int] from the top-level definitions in package <empty>.
[error]   private[io] constructor Coder can only be accessed from package cc.redberry.rings.io in package cc.redberry.rings.
[error]   private constructor Coder can only be accessed from class Coder in package cc.redberry.rings.io.
[error]   new Coder[Int, Int, Int](null, null, null, null, null)
[error]       ^^^^^^^^^^^^^^^^^^^^

Should not have the "classfile is broken" error.

Comment

This library is used by SCAS which is in community build C. We run into it as soon as we need to calculate the constructor denotation for Coder. The SCAS library didn't previously require this for some reason, but we need it for #26156.

Metadata

Metadata

Assignees

Labels

area:jdkIssues tied to artifacts published under a particular jdkcompat:javaitype:bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions