2

I have come across a statement in scalatest documentation:

It must be defined in Java instead of Scala so it will be accessible at runtime.

This is quite weird as I was under the impression that Scala annotation is stronger than its Java counterpart. Why this feature is missing? Is there a plan to add it back?

tribbloid
  • 4,026
  • 14
  • 64
  • 103
  • 1
    I dont think that Scala is in favour of annotations http://stackoverflow.com/questions/8609218/why-scala-people-dont-like-annotation – Sleiman Jneidi Jul 28 '16 at 22:12

1 Answers1

4

There is no known plan to have Scala support annotations retained at runtime (the issue has been known for a while but as this page says, it won't be fixed).

Lukas Rytz, a Scala committer, explained on a post on the scala-language mailing list:

It's definitely non-trivial. Java annotations have specific representation in bytecode [...], which would require changes to Scala's bytecode generator.

Also the language of java annotations is quite special, different from the rest of the Java language [...], so one would need to define how this can be represented in a Scala class.

stefanobaghino
  • 11,253
  • 4
  • 35
  • 63
  • Wow, I don't know its that complex, but I assume that all scala specialist know some Java & reflection so this won't be a big problem. – tribbloid Jul 29 '16 at 19:05