Malformed class name
cvogt opened this issue · comments
Jan Christopher Vogt commented
scala> import ai.x.diff._
import ai.x.diff._
scala> case class Foo(i: Int, s: String)
defined class Foo
scala> case class Bar(d: Double, f: Foo)
defined class Bar
scala> val b1 = Bar(1.0,Foo(1,"test"))
b1: Bar = Bar(1.0,Foo(1,test))
scala> val b2 = Bar(2.0,Foo(1,"baz"))
b2: Bar = Bar(2.0,Foo(1,baz))
scala> DiffShow.diff(b1, b2)
java.lang.InternalError: Malformed class name
at java.lang.Class.getSimpleName(Class.java:1330)
at ai.x.diff.DiffShowInstances$CaseClassDiffShow.diff(diff.scala:207)
at ai.x.diff.DiffShow$.diff(diff.scala:64)
at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:99)
at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:95)
at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:99)
at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:95)
at ai.x.diff.DiffShowInstances$CaseClassDiffShow.diff(diff.scala:201)
at ai.x.diff.DiffShow$.diff(diff.scala:64)
... 32 elided
scala>
Jordi commented
Same error here. :-(
Jan Christopher Vogt commented
It's related a bug when nesting objects or classes inside other object or classes
https://issues.scala-lang.org/browse/SI-5425
As a workaround, avoid this and put them top-level.
Alan Johnson commented
Hmm, reorganizing my code to not have nested classes isn't really a viable solution for me. It's weird though, the only place I see getSimpleName
seems protected by a try
/catch
. Where's this actually blowing up?
Aaron Li commented
@acjay There are two versions of this package on Maven. It seems only "ai.x" %% "diff" % "1.2.0-get-simple-name-fix"
has the try/catch
block.
Yuriy Badalyants commented
Actually, it should be fixed through #19