mirror of
https://github.com/sbt/sbt.git
synced 2026-10-08 02:53:10 +02:00
* move TrapExit, SelectMainClass to run module * rearrange some compilation-related code * Jetty-related code moved to web module
22 lines
432 B
Scala
22 lines
432 B
Scala
/* sbt -- Simple Build Tool
|
|
* Copyright 2008 Mark Harrah
|
|
*/
|
|
package sbt
|
|
|
|
private final class LazyVar[T](initialValue: => T) extends NotNull
|
|
{
|
|
private[this] var value: Option[T] = None
|
|
def apply() =
|
|
synchronized
|
|
{
|
|
value match
|
|
{
|
|
case Some(v) => v
|
|
case None =>
|
|
val newValue = initialValue
|
|
value = Some(newValue)
|
|
newValue
|
|
}
|
|
}
|
|
def update(newValue: T) = synchronized { value = Some(newValue) }
|
|
} |