diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2008-07-28 18:05:50 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2008-07-28 18:05:50 +0000 |
commit | 90200957ca0beb4db24555a2563d0a902de0078d (patch) | |
tree | 77ad1d2465b247d5df397e7e744d5a2bff459801 /src/library/scala/UninitializedFieldError.scala | |
parent | 8bacd7cf469bd3097070e74e8bb72010403d21e6 (diff) | |
download | scala-90200957ca0beb4db24555a2563d0a902de0078d.tar.gz scala-90200957ca0beb4db24555a2563d0a902de0078d.tar.bz2 scala-90200957ca0beb4db24555a2563d0a902de0078d.zip |
Added -Ycheckinit, which causes all getters to ...
Added -Ycheckinit, which causes all getters to check that fields are
initialized before being used. It reuses the same machinery (and
bitmaps) as lazy values. For now it requires the new initialization
order (-Xexperimental) to work.
Diffstat (limited to 'src/library/scala/UninitializedFieldError.scala')
-rw-r--r-- | src/library/scala/UninitializedFieldError.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/library/scala/UninitializedFieldError.scala b/src/library/scala/UninitializedFieldError.scala new file mode 100644 index 0000000000..255b1eef5f --- /dev/null +++ b/src/library/scala/UninitializedFieldError.scala @@ -0,0 +1,29 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id: $ + + +package scala + +import Predef._ + +/** This class implements errors which are thrown whenever a + * field is used before it has been initialized. + * + * Such runtime checks are not emitted by default. See the + * compiler documentation for knowing how to turn them on. + * + * Note: This check requires the new initialization order, + * planned for 2.8.0 and available under -Xexperimental. + */ +final case class UninitializedFieldError(msg: String) + extends RuntimeException(msg) { + def this(obj: Any) = + this(if (null != obj) obj.toString() else "null") +} |