Dotty Documentation

0.2.0-bin-SNAPSHOT

private object SafeLazyWrapper

Wrapper around SafeLazy implementations.

xsbti.SafeLazy is part of sbt but it is not part of the interface jar that dotty depends on, therefore we can only access it by reflection, and this will only succeed when dotty is run by sbt (otherwise xsbti.SafeLazy won't be on the classpath at all).

For testing purposes, we still want to be able to run the sbt phases outside of sbt, using -Yforce-sbt-phases and -Ydump-sbt-inc, therefore we provide a copy of SafeLazy in dotty.tools.dotc.sbt.SafeLazy that we use when xsbti.SafeLazy is unavailable.

This raises a question: why bother with xsbti.SafeLazy if we have our own version anyway? Because sbt uses Java serialization to persist the output of the incremental compilation analysis when sbt is stopped and restarted. If we used dotty.tools.dotc.sbt.SafeLazy with sbt, deserialization would fail and every restart of sbt would require a full recompilation.

Note: this won't be needed once we switch to zinc 1.0 where SafeLazy becomes part of the interface jar, see https://github.com/sbt/zinc/issues/113

[-] Constructors

[-] Members

[+] @sharable private val safeLazy : Class [ Nothing <: Any ]
[+] @sharable private val safeLazyApply : Method
[+] @sharable private val safeLazyStrict : Method
[+] def apply ( eval: () => T ) : Lazy [ T ]
[+] def strict ( value: T ) : Lazy [ T ]