Skip to content

Ammonite produces class files with missing InnerClasses attribute, leading to Class#getSimpleName crashing with java.lang.IncompatibleClassChangeError #1614

@smarter

Description

@smarter

This only happens with Scala 3, so it could be an issue in the Scala 3 compiler, but I haven't been able to reproduce it outside of ammonite, so it might be that ammonite is doing something weird, although looking at the code of ammonite I haven't been able to pinpoint what exactly:

Welcome to the Ammonite Repl 3.0.1 (Scala 3.6.3 Java 21.0.6)
@ class Bar(); println((new Bar()).getClass.getSimpleName)
java.lang.IncompatibleClassChangeError: ammonite.$sess.cmd0 and ammonite.$sess.cmd0$Bar disagree on InnerClasses attribute
  java.lang.Class.getDeclaringClass0(Native Method)
  java.lang.Class.isTopLevelClass(Class.java:1971)
  java.lang.Class.getSimpleBinaryName(Class.java:1956)
  java.lang.Class.getSimpleName0(Class.java:1793)
  java.lang.Class.getSimpleName(Class.java:1784)
  ammonite.$sess.cmd0$.<clinit>(cmd0.sc:1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions