Skip to content
This repository has been archived by the owner on Feb 23, 2018. It is now read-only.

Assertions

Paul Phillips edited this page Apr 6, 2011 · 2 revisions

I agree with that. However, it would be nice to make it configurable, similarly to the way javac does. Something like this:

    val assertionsEnabled = getClass().desiredAssertionStatus()

    @inline
    def assert1(prop: => Boolean, msg: => Any): Unit = {
      if (assertionsEnabled && !prop)
        throw new java.lang.AssertionError(msg)
    }
Clone this wiki locally