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/compiler | |
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/compiler')
4 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala index 952925a7cc..9549d4ff94 100644 --- a/src/compiler/scala/reflect/internal/Types.scala +++ b/src/compiler/scala/reflect/internal/Types.scala @@ -6069,7 +6069,7 @@ A type's typeSymbol should never be inspected directly. /** Perform operation `p` on arguments `tp1`, `arg2` and print trace of computation. */ private def explain[T](op: String, p: (Type, T) => Boolean, tp1: Type, arg2: T): Boolean = { - Console.println(indent + tp1 + " " + op + " " + arg2 + "?" /* + "("+tp1.getClass+","+arg2.asInstanceOf[AnyRef].getClass+")"*/) + Console.println(indent + tp1 + " " + op + " " + arg2 + "?" /* + "("+tp1.getClass+","+arg2.getClass+")"*/) indent = indent + " " val result = p(tp1, arg2) indent = indent dropRight 2 diff --git a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala index aa926adecc..6b56d881fc 100644 --- a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala +++ b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala @@ -56,7 +56,7 @@ trait TypeStrings { ) } def scalaName(m: ClassManifest[_]): String = scalaName(m.erasure) - def anyClass(x: Any): JClass = if (x == null) null else x.asInstanceOf[AnyRef].getClass + def anyClass(x: Any): JClass = if (x == null) null else x.getClass private def brackets(tps: String*): String = if (tps.isEmpty) "" diff --git a/src/compiler/scala/tools/nsc/io/Pickler.scala b/src/compiler/scala/tools/nsc/io/Pickler.scala index bae69b6bfa..5bb8bdda35 100644 --- a/src/compiler/scala/tools/nsc/io/Pickler.scala +++ b/src/compiler/scala/tools/nsc/io/Pickler.scala @@ -246,7 +246,7 @@ object Pickler { p.tryPickle(wr, x) || qq.tryPickle(wr, x) def pickle(wr: Writer, x: T) = require(tryPickle(wr, x), - "no pickler found for "+x+" of class "+x.asInstanceOf[AnyRef].getClass.getName) + "no pickler found for "+x+" of class "+x.getClass.getName) def unpickle(rd: Lexer) = p.unpickle(rd) orElse qq.unpickle(rd) } diff --git a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala index d6d19eef92..07fe254410 100644 --- a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala +++ b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala @@ -134,7 +134,7 @@ object ScalaClassLoader { } /** Finding what jar a clazz or instance came from */ - def origin(x: Any): Option[URL] = originOfClass(x.asInstanceOf[AnyRef].getClass) + def origin(x: Any): Option[URL] = originOfClass(x.getClass) def originOfClass(x: Class[_]): Option[URL] = Option(x.getProtectionDomain.getCodeSource) flatMap (x => Option(x.getLocation)) } |