trait
DelayedInit extends AnyRef
Abstract Value Members
-
abstract
def
delayedInit(x: ⇒ Unit): Unit
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Classes and objects (but note, not traits) inheriting the
DelayedInit
marker trait will have their initialization code rewritten as follows:code
becomesdelayedInit(code)
.Initialization code comprises all statements and all value definitions that are executed during initialization.
Example:
Should result in the following being printed:
dummy text, printed before initialization of C this is the initialization code of C
(Since version 2.11.0) DelayedInit semantics can be surprising. Support for
App
will continue. See the release notes for more details: https://github.com/scala/scala/releases/tag/v2.11.0-RC1"Delayed Initialization" subsection of the Scala Language Specification (section 5.1)