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

StackOverflowError accessing inner, private case class and companion object #9841

Closed
scabug opened this issue Jun 30, 2016 · 10 comments
Closed
Milestone

Comments

@scabug
Copy link

scabug commented Jun 30, 2016

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

scala> class Container { private case class Inner(s: String); private object Inner { val Empty = Inner("") }; private val state = Inner.Empty }
defined class Container

scala> new Container
java.lang.StackOverflowError
  at Container.$line3$$read$Container$$Inner$lzycompute(<console>:11)
  at Container.$line3$$read$Container$$Inner(<console>:11)
  ... 1022 elided

Notably this works fine if you remove all instances of "private".

@scabug
Copy link
Author

scabug commented Jun 30, 2016

Imported From: https://issues.scala-lang.org/browse/SI-9841?orig=1
Reporter: James Koch (james.koch)
Affected Versions: 2.11.8

@scabug
Copy link
Author

scabug commented Aug 11, 2016

@jrudolph said:
I can confirm this as a regression in Scala 2.11.8.

@scabug
Copy link
Author

scabug commented Aug 11, 2016

@som-snytt said:
I can confirm this as a progression in Scala 2.12.0.

@scabug scabug closed this as completed Aug 11, 2016
@scabug
Copy link
Author

scabug commented Aug 11, 2016

@paulp said:
From your TIME MACHINE?

@scabug
Copy link
Author

scabug commented Aug 12, 2016

@jrudolph said:
@SethTisue By closing this ticket are you implying that regressions in 2.11.x like this will not be fixed any more?

@scabug
Copy link
Author

scabug commented Aug 12, 2016

@paulp said:
@jrudolph The last 2.11.x release is scheduled for Oct 24th. So the answer must either be "they will not be addressed" or " they will not be addressed."

@scabug
Copy link
Author

scabug commented Aug 12, 2016

@lrytz said:
A regression test would still be welcome :)

@scabug
Copy link
Author

scabug commented Aug 12, 2016

@SethTisue said:
@jrudolph It's impossible to generalize 100% about this, since if a particular issue is really severe enough, the rules change. (That's how 2.10.6 happened, and there are probably other examples in Scala history.)

I closed this ticket because I strongly suspect the core team won't be addressing it for 2.11.x, on the grounds that it isn't critical. It appears to me that in a real codebase, working around it wouldn't be that painful.

If you think the regression is important enough that we ought to reconsider whether we tackle this ourselves, go ahead and make your argument here.

Also, we could still accept a fix for 2.11.x that someone else submitted. Whether such a patch would be accepted for 2.11.9 would depend on the usual risk/benefit tradeoffs.

@scabug
Copy link
Author

scabug commented Aug 15, 2016

@jrudolph said:
Thanks for the explanation, @SethTisue. IMO regressions always need some extra consideration as it is so easy to get stuck if the update path is obstructed by regressions. But I agree that this regression doesn't seem too bad as the workaround of not using private object is working fine.

@scabug
Copy link
Author

scabug commented Aug 17, 2016

@som-snytt said:
Tests scala/scala#5348 scala/scala#5349

@scabug scabug added this to the 2.12.0-M5 milestone Apr 7, 2017
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