-
Notifications
You must be signed in to change notification settings - Fork 1.1k
IncompatibleClassChangeError on inner class java.lang.Class #4192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is probably related to all the changes to the InnerClass table generation done by @lrytz in the scalac backend since the dotty backend was forked (September 2014), good luck figuring it out: https://github.com/scala/scala/blob/2a88024236cdab266cabe11414120a6af796a56f/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala#L333-L588 |
For reference, this issue is a blocker for generating GraalVM native images for code generated by the dotty compiler. GraalVM static analysis relies on those The scala compiler had a similar issue which got fixed in scala 2.12.7. scala/bug/issues/10487 |
Not sure if this should be treated as a separate issue or as a part of this one but while trying to construct a more complex test case for this I found out that there is a discrepancy between scala 2 and 3 about how class files are generated. object Test {
class Quux
def main(args: Array[String]): Unit = {
class Foo {
class Bar
println(classOf[Bar].getDeclaringClass)
def test() = {
class Baz
println(classOf[Baz].getDeclaringClass)
}
}
println(classOf[Foo].getDeclaringClass)
val foo = new Foo
foo.test()
}
} as the result of transformations done in |
Yes, those are just implementation details.
That won't be an issue once #5812 is fixed. |
In Scala 2, at least, I believe that very long names should have their "middle" replaced by a hash (MD5, I think), so they are never longer than a certain length. It's the "middle" so that the few characters at the start and end remain unencrypted and readable. |
…neration Fix #4192: Properly set InnerClasses end EnclosingMethod in class files
Awesome! |
If you wish to try it out early, the fix should be part of the latest nightly: https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3.0.0-RC2/3.0.0-RC2-bin-20210310-4af1386-NIGHTLY/ |
fails with
It works on
scalac
.The text was updated successfully, but these errors were encountered: