diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-04-01 22:41:58 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-04-01 22:52:49 +0200 |
commit | ff442fc7bc7ab0b2fef82762c4705a15d8c17ecd (patch) | |
tree | 906c441643d3c8353e37d597228398f010b52aa7 /src/library/scala/Unit.scala | |
parent | 19dac8212090f81ffd18bad6d7cc929fbff9bec8 (diff) | |
download | scala-ff442fc7bc7ab0b2fef82762c4705a15d8c17ecd.tar.gz scala-ff442fc7bc7ab0b2fef82762c4705a15d8c17ecd.tar.bz2 scala-ff442fc7bc7ab0b2fef82762c4705a15d8c17ecd.zip |
SI-6710 Clarify stub methods in primitive value classes
- Replaces the implementations of box/unbox in AnyVal companions by
`???`, the methods are only stubs, and the impls did not correspond
to the actual behavior. The doc comment already points to the actual
implementation in BoxesRunTime.
- Replaces the body of `getClass` from `null` to `???` and clarifies in
a comment why the overrides exist.
Diffstat (limited to 'src/library/scala/Unit.scala')
-rw-r--r-- | src/library/scala/Unit.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/library/scala/Unit.scala b/src/library/scala/Unit.scala index 018ad24a99..873281bb8f 100644 --- a/src/library/scala/Unit.scala +++ b/src/library/scala/Unit.scala @@ -19,7 +19,8 @@ package scala * method which is declared `void`. */ final abstract class Unit private extends AnyVal { - override def getClass(): Class[Unit] = null + // Provide a more specific return type for Scaladoc + override def getClass(): Class[Unit] = ??? } object Unit extends AnyValCompanion { @@ -29,7 +30,7 @@ object Unit extends AnyValCompanion { * @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 + def box(x: Unit): scala.runtime.BoxedUnit = ??? /** Transform a boxed type into a value type. Note that this * method is not typesafe: it accepts any Object, but will throw @@ -39,7 +40,7 @@ object Unit extends AnyValCompanion { * @throws ClassCastException if the argument is not a scala.runtime.BoxedUnit * @return the Unit value () */ - def unbox(x: java.lang.Object): Unit = () + def unbox(x: java.lang.Object): Unit = ??? /** The String representation of the scala.Unit companion object. */ override def toString = "object scala.Unit" |