Skip to content

Inconsistent InnerClass attribute in delayed init body #10487

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

Closed
retronym opened this issue Aug 30, 2017 · 3 comments
Closed

Inconsistent InnerClass attribute in delayed init body #10487

retronym opened this issue Aug 30, 2017 · 3 comments
Assignees
Labels
Milestone

Comments

@retronym
Copy link
Member

⚡ scala
Welcome to Scala 2.12.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.

scala> :paste -raw
// Entering paste mode (ctrl-D to finish)

package p1; object A extends App { println("here") }

// Exiting paste mode, now interpreting.


scala> val cls = Class.forName("p1.A$delayedInit$body")
cls: Class[_] = class p1.A$delayedInit$body

scala> cls.getEnclosingClass
java.lang.IncompatibleClassChangeError: p1.A and p1.A$delayedInit$body disagree on InnerClasses attribute
  at java.lang.Class.getDeclaringClass0(Native Method)
  at java.lang.Class.getDeclaringClass(Class.java:1235)
  at java.lang.Class.getEnclosingClass(Class.java:1277)
  ... 29 elided
@retronym
Copy link
Member Author

retronym commented Aug 30, 2017

The module class A$ has:

SourceFile: "a.scala"
InnerClasses:
     public static final #12= #9 of #11; //delayedInit$body=class p1/A$delayedInit$body of class p1/A
Error: unknown attribute

But there is no corresponding entry in A$delayedInit$body.class nor in A.class

@shelajev
Copy link

Hi, we hit a similar issue while trying to compile scala or akka apps to native images with GraalVM.
For example, the akka-quickstart-scala uses the
object Main extends App { main class, and we hit the problem as described in graal#370.

Currently it can be worked around by using the Object + main function syntax as described in graal#384, but it's quite inconvenient that it doesn't work out of the box.

I'm not sure I have the understanding of the scala compiler necessary to try fixing it myself. But if I can provide any additional information I'd be happy to, I'd like to fix this issue. Thank you!

@lrytz
Copy link
Member

lrytz commented Jun 13, 2018

scala/scala#6788

@SethTisue SethTisue added this to the 2.12.7 milestone Jun 13, 2018
@lrytz lrytz closed this as completed Jun 14, 2018
lbulej added a commit to renaissance-benchmarks/renaissance that referenced this issue Dec 1, 2020
This should avoid the scalac bug that produces invalid innerClasses
references: scala/bug#10487
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants