diff options
Diffstat (limited to 'src/library/scala/ref/ReferenceWrapper.scala')
-rw-r--r-- | src/library/scala/ref/ReferenceWrapper.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/scala/ref/ReferenceWrapper.scala b/src/library/scala/ref/ReferenceWrapper.scala index afafd97453..e10eebd82f 100644 --- a/src/library/scala/ref/ReferenceWrapper.scala +++ b/src/library/scala/ref/ReferenceWrapper.scala @@ -17,11 +17,11 @@ trait ReferenceWrapper[+T <: AnyRef] extends Reference[T] with Proxy { val underlying: java.lang.ref.Reference[_ <: T] @deprecated def isValid = underlying.get != null override def get = { - val ret = underlying.get.asInstanceOf[T] + val ret = underlying.get if (ret eq null) None else Some(ret) } def apply() = { - val ret = underlying.get.asInstanceOf[T] + val ret = underlying.get if (ret eq null) throw new NoSuchElementException ret } |