diff options
author | Paul Phillips <paulp@improving.org> | 2011-08-27 18:02:01 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-08-27 18:02:01 +0000 |
commit | 2c548eac23014bff46f563dd4fdfd65bc7aaa54c (patch) | |
tree | a6a9309a86d592f3fc21545628f7e38576aeecb0 /src/library | |
parent | 649b4262c4483f12ec4d82549b9860e2f88d33b8 (diff) | |
download | scala-2c548eac23014bff46f563dd4fdfd65bc7aaa54c.tar.gz scala-2c548eac23014bff46f563dd4fdfd65bc7aaa54c.tar.bz2 scala-2c548eac23014bff46f563dd4fdfd65bc7aaa54c.zip |
Replaced various now-unnecessary casts with str...
Replaced various now-unnecessary casts with straight getClass calls.
Closes SI-4780, no review.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/MatchError.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/TraversableLike.scala | 2 | ||||
-rw-r--r-- | src/library/scala/runtime/ScalaRunTime.scala | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/library/scala/MatchError.scala b/src/library/scala/MatchError.scala index 4e19ed1c44..6aa46be6e4 100644 --- a/src/library/scala/MatchError.scala +++ b/src/library/scala/MatchError.scala @@ -25,7 +25,7 @@ final class MatchError(obj: Any) extends RuntimeException { */ private lazy val objString = if (obj == null) "null" - else obj.toString() + " (of class " + obj.asInstanceOf[AnyRef].getClass.getName + ")" + else obj.toString() + " (of class " + obj.getClass.getName + ")" override def getMessage() = objString } diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala index e3d51fde4e..32d697ebb4 100644 --- a/src/library/scala/collection/TraversableLike.scala +++ b/src/library/scala/collection/TraversableLike.scala @@ -627,7 +627,7 @@ trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr] * simple name of the collection class $coll. */ def stringPrefix : String = { - var string = repr.asInstanceOf[AnyRef].getClass.getName + var string = repr.getClass.getName val idx1 = string.lastIndexOf('.' : Int) if (idx1 != -1) string = string.substring(idx1 + 1) val idx2 = string.indexOf('$') diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala index c8cc624468..28a093ce42 100644 --- a/src/library/scala/runtime/ScalaRunTime.scala +++ b/src/library/scala/runtime/ScalaRunTime.scala @@ -25,7 +25,7 @@ import java.lang.reflect.{ Modifier, Method => JMethod } object ScalaRunTime { def isArray(x: AnyRef): Boolean = isArray(x, 1) def isArray(x: Any, atLevel: Int): Boolean = - x != null && isArrayClass(x.asInstanceOf[AnyRef].getClass, atLevel) + x != null && isArrayClass(x.getClass, atLevel) private def isArrayClass(clazz: Class[_], atLevel: Int): Boolean = clazz.isArray && (atLevel == 1 || isArrayClass(clazz.getComponentType, atLevel - 1)) |