2

is there a way to define custom annotations in Scala without resorting the use Java interfaces?

I saw this answer which says it's not possible, but is pretty old (dates back to 2010).

But, even with a recent Scala 2.11.8 compiler, I got the usual message:

warning: Implementation restriction: subclassing Classfile does make your annotation visible at runtime. If that is what you want, you must write the annotation class in Java.

I'm kinda puzzled: it's 2016 and yet, seems like we can't create annotations natively from Scala. Is there any reason about this, or am I doing it wrong somehow?

Thanks!

Community
  • 1
  • 1
Polentino
  • 907
  • 5
  • 16
  • 2
    What do you want to do with them? – Michael Zajac May 23 '16 at 16:21
  • @m-z define an annotation to declare plugins and make them discoverable through Spring in an easy way. So the other devs will have just to add that annotation, fill its parameters, and they'll have everything ready to use. That's one of the usage i have in mind. But yet, is it possible or not without Java? – Polentino May 23 '16 at 20:17

0 Answers0