javaee / javaee-spec

Java EE Platform Specification
https://javaee.github.io/javaee-spec
Other
389 stars 69 forks source link

Adapt to Java SE 8 Repeating Annotations #36

Open glassfishrobot opened 10 years ago

glassfishrobot commented 10 years ago

Java SE 8 introduces the capability of repeating annotations: http://docs.oracle.com/javase/tutorial/java/annotations/repeating.html. There are a number of existing Java EE annotations that could adapt to the feature (fortunately in a fairly backwards compatible fashion - the Java SE feature was clearly designed with backwards compatibility in mind).

The following is a list of annotations that are fairly clear candidates, in roughly priority order (keep in mind, it is possible I missed something - hopefully spec leads will do a far better job at identifying required changes):

Other than the above, there are other annotations where the value proposition of the repeatable annotation semantics is less clear. It is highly subjective, but in these cases having an explicit containing annotation may add clarity since the repeating annotations are more logically grouped. On the other hand, it may be simpler for developers if repeating annotations are used consistently across the platform.

The following is a list, in roughly priority order (keep in mind, it is possible I missed something - hopefully spec leads will do a far better job at identifying required changes):

The repeating annotations feature also opens up some interesting possibilities such as overlapping @Path annotations (effectively aliases), various @QueryParam, etc annotations mapping to the same Java method parameter and the like. The value in keeping things simple may override any compelling semantic benefit to be gained in such cases...

Do let me know if anything needs to be explained further - I am happy to help. I am also happy to disperse these JIRA issues across various projects if needed. Doing one JIRA for the platform was easier especially since this involves some older Java EE specifications.

Please note that these are purely my personal views and certainly not of Oracle's as a company.

glassfishrobot commented 10 years ago

Reported by reza_rahman

glassfishrobot commented 10 years ago

ldemichiel said: All of the above JPA annotations should be candidates (and equivalent in prioritization). Note that there are currently no "plural" versions of SequenceGenerator or TableGenerator, but these should be discussed.

There are a few other annotations that are candidates as well. Listing here so that we can track them all together:

EJB: javax.ejb.EJB

JPA: javax.persistence.Convert

Common Annotations: javax.annotation.Resource

glassfishrobot commented 10 years ago

nigeldeakin said: I've logged JMS_SPEC-151 to define the corresponding changes to the JMS annotations, and added a dependency on it.

glassfishrobot commented 7 years ago

@lukasj said: @ldemichiel: for JPA, we already applied @Repeatable to few annotations through https://java.net/jira/browse/JPA_SPEC-115 in http://git.eclipse.org/c/eclipselink/javax.persistence.git/commit/?id=f9db12ae58aab438ecbf09467f0c430d40eab4f1

are missing, will address...

glassfishrobot commented 10 years ago

Issue-Links: depends on JMS_SPEC-151 relates to JPA_SPEC-115

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAVAEE_SPEC-36