VerifyError ascribing java annotations to scala.annotation.Annotation

88 views
Skip to first unread message

Daniel Armak

unread,
Feb 1, 2016, 1:51:00 PM2/1/16
to scala-l...@googlegroups.com
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.

-- 
Daniel Armak

Daniel Armak

unread,
Feb 1, 2016, 2:10:41 PM2/1/16
to scala-l...@googlegroups.com

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
-- 
Daniel Armak

Lukas Rytz

unread,
Feb 2, 2016, 8:31:22 AM2/2/16
to scala-language
This is another incarnation of https://issues.scala-lang.org/browse/SI-9400
see also the discussion on https://github.com/scala/scala/pull/4638.

Daniel Armak

unread,
Feb 3, 2016, 4:18:03 AM2/3/16
to scala-l...@googlegroups.com
It's mentioned in a comment on SI-9400, but not in the title or description, and it's unrelated to subclassing a Java annotation, so the ticket is hard to find. I'd create a new, more prominent ticket, but I don't know what your policy is.

Thanks,

Daniel Armak

--
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.

Lukas Rytz

unread,
Feb 3, 2016, 11:28:12 AM2/3/16
to scala-l...@googlegroups.com
Feel free to create a ticket; make sure to link to the other related issues and discussions.

--
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.

Daniel Armak

unread,
Feb 4, 2016, 4:24:48 AM2/4/16
to scala-l...@googlegroups.com
Created SI-9644.

Daniel Armak
Reply all
Reply to author
Forward
0 new messages