java - Error setting a default null value for an annotation's field -


Why am I getting an error "attribute values ​​should be stable" empty continuous ???

  @Target (ElementType.TePE) @action (retention policy. RUNTEm) public @interface some interface {class & lt;? Foo & gt; Bar (default); // It does not compile  

T why, but it is very clear :

  Discussion Note that zero is not a legal element value for any element type.  

And the definition of a default element is:

  DefaultValue: Default Element value  

Unfortunately I'm searching for it Edit: A small Googleing is found in JSR-308, where they argue that there are very baseless compiler error messages in the characteristics of the new language (enmoses and now annotations). Permission to tap in this situation:

We note some potential objections in the proposal.

The proposal was not possible before that which is not possible.

The special value defined by the programmer provides a better document than zero, which means "none", "undefined", tap automatically, etc.

The proposal is more error-prone.

The standard phrase can make more vocabulary from this proposal. Currently only one annotation user can check their special values. With the proposal, many tools that process annotation will have to check whether the value of a field is null or not that they throw an empty pointer exception.

I think only the last two digits are relevant "why it is not in the first place." The last thing is certainly a good thing - never worrying about a annotation processor They should get a blank on the annotation value. I have to see that the higher the job of the annotation processor and other such framework codes, the developers' code should be examined in such a way to make it clear rather than other methods, but of course it would be difficult to prove it right.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -