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

delayedInit not called when lazy val exist in object #7042

Closed
scabug opened this issue Jan 30, 2013 · 2 comments
Closed

delayedInit not called when lazy val exist in object #7042

scabug opened this issue Jan 30, 2013 · 2 comments
Milestone

Comments

@scabug
Copy link

scabug commented Jan 30, 2013

object DelayedInitTest extends DelayedInit {
        def delayedInit(x: => Unit) {
          println("delayed init")
        }

        val message = "message"
        def test = println(message)
      }

DelayedInitTest.test

it give output:
delayed init
null

then change message to lazy

object DelayedInitTest extends DelayedInit {
        def delayedInit(x: => Unit) {
          println("delayed init")
        }

        lazy val message = "message"
        def test = println(message)
      }

DelayedInitTest.test

it give output:
null

looks like def delayedInit(x: => Unit) not executed anymore

@scabug
Copy link
Author

scabug commented Jan 30, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7042?orig=1
Reporter: alexey nesterov (tort)
Assignee: @JamesIry
Affected Versions: 2.10.0

@SethTisue SethTisue added this to the Backlog milestone Mar 2, 2018
@SethTisue
Copy link
Member

DelayedInit is deprecated

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

No branches or pull requests

2 participants