scala> import scala.reflect.runtime.universe.typeOf
scala> import scala.annotation.Annotation
scala> import java.lang.Deprecated
scala> typeOf[Deprecated] <:< typeOf[Annotation]
res0: Boolean = true
scala> val x: Deprecated = null
x: Deprecated = null
scala> x: Annotation
java.lang.VerifyError: Bad type on operand stack
The same happens with any Java annotation, Deprecated isn’t special.
What is the intention? Why should Java annotations subtype scala.annotation.Annotation
?
This is mentioned in a comment in SI-9400, but that’s about a different issue and I think if this is a bug it deserves its own ticket.
Even weirder:
scala> val x: Deprecated = null
x: Deprecated = null
scala> x: StaticAnnotation
res14: scala.annotation.StaticAnnotation = null
scala> (x: StaticAnnotation): Annotation
res15: scala.annotation.Annotation = null
scala> x: Annotation
java.lang.VerifyError: Bad type on operand stack
--
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-languag...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "scala-language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-language/4Cjr_n3CAr0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scala-languag...@googlegroups.com.