Skip to content

IncompatibleClassChangeError on getDeclaringClass #7994

Closed
@scabug

Description

@scabug

Executing this simple snippet of code:

object Test {
  def main(args: Array[String]): Unit = {
    val outter = new MyTest {
      val inner = new MyTest {
      }
    }
  }
}

class MyTest {
  println(s"${getClass.getName} - ${getClass.getDeclaringClass}")
}

Results in:

java.lang.IncompatibleClassChangeError: Test$ and Test$$anon$1$$anon$2 disagree on InnerClasses attribute
java.lang.IncompatibleClassChangeError: Test$ and Test$$anon$1$$anon$2 disagree on InnerClasses attribute
	at java.lang.Class.getDeclaringClass0(Native Method)
	at java.lang.Class.getDeclaringClass(Class.java:1101)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions