- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
scala.tools.nsc.symtab.AnnotationInfo does not return default values
When processing annotations in a compiler plugin, I want to get the
value of it's parameters.
An AnnotationInfo is used to represent the annotation in the plugin.
Those parameters should be in the Map returned by "assocs", but only
the explicit parameters are in there.
My plugin runs after typer, so if default values are filled in a later
phase, that would be an explanation.
The point of default values are so that you always get a value, even
if the user doesn't give you one, so it's kind of pointless if you
cannot get the default value and have to store it doubly inside your
compiler plugin as well, in particular when you have many. My
annotation has currently *13* default parameters, and is going to get
I have found a post for Java that says you can do:
But that's a pain, and I'm not even sure if it would work if the
annotation itself is in the unit that is being compiled. There must be
a better way to fix this. If there is no way, than I would consider
this a compiler bug.