summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index 7c4deb78f4..ecfdfd9bb0 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -1268,7 +1268,9 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid {
case CHECK_CAST(tpe) =>
tpe match {
case REFERENCE(cls) =>
- jcode emitCHECKCAST new JObjectType(javaName(cls))
+ // No need to checkcast for Objects
+ if (cls != ObjectClass)
+ jcode emitCHECKCAST new JObjectType(javaName(cls))
case ARRAY(elem) =>
jcode emitCHECKCAST new JArrayType(javaType(elem))
case _ =>