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

Properties("") tests are suffering of deadlock to static scala initializers #155

Open
pchlupacek opened this issue Mar 25, 2015 · 0 comments

Comments

@pchlupacek
Copy link

Current version of Scalacheck when using the Properties("") helper is suffering from deadlock as documented in https://issues.scala-lang.org/browse/SI-7646 or http://stackoverflow.com/questions/15176199/scala-parallel-collection-in-object-initializer-causes-a-program-to-hang

It seems that making the tests to extends DelayedInit (deprecated) is resolving the issue. That means in other words if Properties will extend the App trait it is reasonable workaround. However that makes the Spec invisible to sbt.

Would be nice if Properties will be extending the App and be still visible to sbt.

There is a simple workaround using DelayedInit that can be used for now, before DelayedInit is removed:

class DProperties(name:String)  extends Properties(name) with DelayedInit {

  var init: Option[()  Unit] = None

  override def delayedInit(x:  Unit): Unit = init = Some(()  x)

  override def main(args: Array[String]) = {
    init.foreach(_())
    super.main(args)
  }

}
@pchlupacek pchlupacek changed the title Properties("") tests are suffering of diadlock to static scala initializers Properties("") tests are suffering of deadlock to static scala initializers Mar 25, 2015
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