While looking at
this question on stack overflow I found that annotations that are set on vals in companion objects aren't carried over to the static forwarder in the class. Howver, they are carried over for methods. Is there a reason for this, or is it a bug/feature?
Here is an example:
object Foobar {
@DataPoints
val value = 5;
@DataPoints
def method() = 5
}
class Foobar {
}
with the above code, the method() static forwarder that appears in the .class has the @DataPoints annotation, but the value() static forward does not.
Is it that the annotation may not be applicable to a method, but may only be applicable to a field, and therefore should not be copied? (ElementType.FIELD/METHOD). If this is the case then the correct behviour would be to issue a warning).
If anybody knows, and could say whether or not I should submit a bug report/enhancement request, I'd be grateful.
Thanks.
Matthew Farwell.