Re: Platform wide guideline for build-in annotation literals?
Bill Shannon
Arjan Tijms wrote on 09/19/17 01:29 PM:
On Tue, Sep 19, 2017 at 12:09 pm, Bill Shannon wrote:Some of the annotations have literals and some do not. There may be some rationale for why only some of the annotations need literals, but it wasn't explained. Hopefully this is very much an advanced case and not something that typical applications will need to do. If an annotation evolves to have members, would you still want a static instance? Wouldn't it be simpler if there was always just one way to get an instance?Perhaps, but without members the annotation instance is a totally static singleton, like enum values basically. With members this is obviously not the case. Depending on each spec to do it means that some won't.Possibly indeed, but not sure how feasible it is to get that in. This is not the first thing about annotations that we wished every spec would handle. I really wish we could push more of this into the JDK, or find a way to centralize all of this in a place that would apply to all Java EE uses of annotations automatically. Lacking that, a "design pattern" as you suggest might be the best approach. Another item for the future Eclipse project to address! :-)
|
|