Skip to content
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

VerifyError when referring to object which refers to itself #3913

Closed
scabug opened this issue Oct 9, 2010 · 9 comments
Closed

VerifyError when referring to object which refers to itself #3913

scabug opened this issue Oct 9, 2010 · 9 comments

Comments

@scabug
Copy link

scabug commented Oct 9, 2010

in the following scenario, a java.lang.VerifyError is thrown at runtime as soon as you try to reference LimboStage:

abstract sealed class Stage( val transits: Set[ Stage ])
case object IdleStage   extends Stage( Set.empty )
case object LimboStage  extends Stage( Set( IdleStage, LimboStage ))
Exception in thread "main" java.lang.VerifyError: (class: LimboStage$$, method: <init> signature: ()V) Expecting to find object/array on stack
	at Test$$.main(Test.scala:7)
	at Test.main(Test.scala)
@scabug
Copy link
Author

scabug commented Oct 9, 2010

Imported From: https://issues.scala-lang.org/browse/SI-3913?orig=1
Reporter: @Sciss
Attachments:

  • Test.scala (created on Oct 9, 2010 8:34:24 PM UTC, 262 bytes)
  • Test2.scala (created on Oct 9, 2010 8:50:13 PM UTC, 346 bytes)
  • Test3.scala (created on Oct 9, 2010 8:53:20 PM UTC, 397 bytes)

@scabug
Copy link
Author

scabug commented Oct 9, 2010

@Sciss said:
Reproduces error

@scabug
Copy link
Author

scabug commented Oct 9, 2010

@Sciss said:
there is even more craziness. Test2 produces the following output:

idle transits = Set(BusyStage)
busy transits = Set(null)

so there is uninitialized stuff!

@scabug
Copy link
Author

scabug commented Oct 9, 2010

@Sciss said:
Another related bug

@scabug
Copy link
Author

scabug commented Oct 9, 2010

@Sciss said:
A workaround is in Test3 -- suggesting that the problem has to do with the way the object's constructor is called.

@scabug
Copy link
Author

scabug commented Oct 9, 2010

@Sciss said:
Replacing the constructor argument by an abstract method is a workaround

@scabug
Copy link
Author

scabug commented Oct 11, 2010

@paulp said:
Hey, I already fixed this once, waaaay back in #473. Not well enough I guess. Let's see if I've learned anything in the 20 months since r17118.

@scabug
Copy link
Author

scabug commented Oct 11, 2010

@paulp said:
(In r23222) Better check for objects trying to sneak themselves into the
superconstructor arguments. Closes #3913, no review.

@scabug
Copy link
Author

scabug commented Oct 11, 2010

@paulp said:
I'm ignoring the examples involving cycles as covered elsewhere (e.g. #3342.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant