diff options
author | Paul Phillips <paulp@improving.org> | 2011-04-01 05:02:30 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-04-01 05:02:30 +0000 |
commit | 9b3852f26201aee7761637f89979dab2a71294a9 (patch) | |
tree | a26f7cd79256084b88153d1ba81e8c9d7c59dc59 /src/library/scala/Unit.scala | |
parent | 305f49ce8f7358636bf81a7aca29d8ab42d98ed4 (diff) | |
download | scala-9b3852f26201aee7761637f89979dab2a71294a9.tar.gz scala-9b3852f26201aee7761637f89979dab2a71294a9.tar.bz2 scala-9b3852f26201aee7761637f89979dab2a71294a9.zip |
A less ad hoc infrastructure for generating Any...
A less ad hoc infrastructure for generating AnyVal sources. A few more
comments on said sources. No review.
Diffstat (limited to 'src/library/scala/Unit.scala')
-rwxr-xr-x | src/library/scala/Unit.scala | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/library/scala/Unit.scala b/src/library/scala/Unit.scala index e69f95bf89..58b024273b 100755 --- a/src/library/scala/Unit.scala +++ b/src/library/scala/Unit.scala @@ -10,7 +10,6 @@ package scala -import runtime.BoxedUnit /** Unit is a member of the value classes, those whose instances are * not represented as objects by the underlying host system. There is @@ -18,8 +17,28 @@ import runtime.BoxedUnit */ final class Unit extends AnyVal { } + object Unit extends AnyValCompanion { - override def toString = "object scala.Unit" - def box(x: Unit): BoxedUnit = BoxedUnit.UNIT + + /** Transform a value type into a boxed reference type. + * + * @param x the Unit to be boxed + * @return a scala.runtime.BoxedUnit offering `x` as its underlying value. + */ + def box(x: Unit): scala.runtime.BoxedUnit = scala.runtime.BoxedUnit.UNIT + + /** Transform a boxed type into a value type. Note that this + * method is not typesafe: it accepts any Object, but will throw + * an exception if the argument is not a scala.runtime.BoxedUnit. + * + * @param x the scala.runtime.BoxedUnit to be unboxed. + * @throws ClassCastException if the argument is not a scala.runtime.BoxedUnit + * @return the Unit value () + */ def unbox(x: java.lang.Object): Unit = () -}
\ No newline at end of file + + /** The String representation of the scala.Unit companion object. + */ + override def toString = "object scala.Unit" +} + |