You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One no longer needs to cast a primitive to an AnyRef before
calling getClass. So,
obj.asInstanceOf[AnyRef].getClass
should be replaced with
obj.getClass
in the source tree.
Running the following script:
find . -name '*.scala' -type f -exec grep --with-filename 'asInstanceOf[AnyRef].getClass' {} ;
shows the following files can be fixed:
./compiler/scala/reflect/internal/Types.scala: Console.println(indent + tp1 + " " + op + " " + arg2 + "?" /* + "("+tp1.getClass+","+arg2.asInstanceOf[AnyRef].getClass+")"*/)
./compiler/scala/tools/nsc/util/ScalaClassLoader.scala: def origin(x: Any): Option[URL] = originOfClass(x.asInstanceOf[AnyRef].getClass)
./compiler/scala/tools/nsc/interpreter/TypeStrings.scala: def anyClass(x: Any): JClass = if (x == null) null else x.asInstanceOf[AnyRef].getClass
./compiler/scala/tools/nsc/io/Pickler.scala: "no pickler found for "+x+" of class "+x.asInstanceOf[AnyRef].getClass.getName)
./library/scala/runtime/ScalaRunTime.scala: x != null && isArrayClass(x.asInstanceOf[AnyRef].getClass, atLevel)
./library/scala/collection/TraversableLike.scala: var string = repr.asInstanceOf[AnyRef].getClass.getName
./library/scala/MatchError.scala: else obj.toString() + " (of class " + obj.asInstanceOf[AnyRef].getClass.getName + ")"
The text was updated successfully, but these errors were encountered:
Commit Message Bot (anonymous) said:
(extempore in r25575) Replaced various now-unnecessary casts with straight getClass
calls. Closes #4780, no review.
One no longer needs to cast a primitive to an AnyRef before
calling getClass. So,
obj.asInstanceOf[AnyRef].getClass
should be replaced with
obj.getClass
in the source tree.
Running the following script:
find . -name '*.scala' -type f -exec grep --with-filename 'asInstanceOf[AnyRef].getClass' {} ;
shows the following files can be fixed:
./compiler/scala/reflect/internal/Types.scala: Console.println(indent + tp1 + " " + op + " " + arg2 + "?" /* + "("+tp1.getClass+","+arg2.asInstanceOf[AnyRef].getClass+")"*/)
./compiler/scala/tools/nsc/util/ScalaClassLoader.scala: def origin(x: Any): Option[URL] = originOfClass(x.asInstanceOf[AnyRef].getClass)
./compiler/scala/tools/nsc/interpreter/TypeStrings.scala: def anyClass(x: Any): JClass = if (x == null) null else x.asInstanceOf[AnyRef].getClass
./compiler/scala/tools/nsc/io/Pickler.scala: "no pickler found for "+x+" of class "+x.asInstanceOf[AnyRef].getClass.getName)
./library/scala/runtime/ScalaRunTime.scala: x != null && isArrayClass(x.asInstanceOf[AnyRef].getClass, atLevel)
./library/scala/collection/TraversableLike.scala: var string = repr.asInstanceOf[AnyRef].getClass.getName
./library/scala/MatchError.scala: else obj.toString() + " (of class " + obj.asInstanceOf[AnyRef].getClass.getName + ")"
The text was updated successfully, but these errors were encountered: