GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Adapt to Java SE 8 Repeating Annotations · Issue #36 · javaee/javaee-spec

This repository was archived by the owner on Jan 30, 2019. It is now read-only.
This repository was archived by the owner on Jan 30, 2019. It is now read-only.

Adapt to Java SE 8 Repeating Annotations #36

Copy link
Copy link
Open
Open
Adapt to Java SE 8 Repeating Annotations#36
Copy link
Assignees
ldemichiel
Labels
Priority: MajorType: New Feature

Description

@glassfishrobot
glassfishrobot
opened on Mar 20, 2014
Issue body actions

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):

  • EJB
    • javax.ejb.Schedule
  • Java EE/Common Annotations
    • javax.annotation.sql.DataSourceDefinition
  • JPA
    • javax.persistence.NamedQuery
    • javax.persistence.NamedNativeQuery
    • javax.persistence.SqlResultSetMapping
    • javax.persistence.NamedEntityGraph
    • javax.persistence.NamedStoredProcedureQuery
    • javax.persistence.SequenceGenerator
    • javax.persistence.TableGenerator
    • javax.persistence.PersistenceContext
    • javax.persistence.PersistenceUnit
    • (There may be others in JPA)
  • JMS
    • javax.jms.JMSDestinationDefinition
    • javax.jms.JMSConnectionFactoryDefinition
  • JavaMail
    • javax.mail.MailSessionDefinition
  • JSF
    • javax.faces.application.ResourceDependency
    • javax.faces.event.ListenerFor
  • JCA
    • javax.resource.AdministeredObjectDefinition
    • javax.resource.ConnectionFactoryDefinition
    • javax.resource.spi.ConnectionDefinition
    • (There may be others in JCA)
  • JAX-WS
    • javax.xml.ws.WebServiceRef
    • (There may be others in JAX-WS)

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):

  • JPA
    • javax.persistence.SecondaryTable
    • javax.persistence.JoinColumn
    • javax.persistence.AttributeOverride
    • javax.persistence.AssociationOverride
    • javax.persistence.PrimaryKeyJoinColumn
    • javax.persistence.MapKeyJoinColumn
    • (There may be others in JPA)
  • Bean Validation
    • javax.validation.constraints.NotNull
    • javax.validation.constraints.Size
    • javax.validation.constraints.Min
    • javax.validation.constraints.Max
    • javax.validation.constraints.DecimalMin
    • javax.validation.constraints.DecimalMax
    • javax.validation.constraints.Pattern
    • javax.validation.constraints.Digits
    • javax.validation.constraints.Past
    • javax.validation.constraints.Future
    • javax.validation.constraints.AssertTrue
    • javax.validation.constraints.AssertFalse
    • javax.validation.constraints.Null
    • javax.validation.groups.ConvertGroup
    • javax.validation.OverridesAttribute
  • JAXB
    • javax.xml.bind.annotation.XmlElement
    • javax.xml.bind.annotation.XmlSchemaType
    • (there may be others in JAXB)

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.

Activity

  1. glassfishrobot commented on Mar 20, 2014

    @glassfishrobot
    glassfishrobot
    on Mar 20, 2014
    Author
    More actions

    Reported by reza_rahman

  2. glassfishrobot commented on Mar 20, 2014

    @glassfishrobot
    glassfishrobot
    on Mar 20, 2014
    Author
    More actions

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

  3. glassfishrobot commented on Mar 20, 2014

    @glassfishrobot
    glassfishrobot
    on Mar 20, 2014
    Author
    More actions

    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

  4. glassfishrobot commented on May 19, 2014

    @glassfishrobot
    glassfishrobot
    on May 19, 2014
    Author
    More actions

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

  5. glassfishrobot commented on Feb 10, 2017

    @glassfishrobot
    glassfishrobot
    on Feb 10, 2017
    Author
    More actions

    @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

    • javax.persistence.SequenceGenerator
    • javax.persistence.TableGenerator

    are missing, will address...

  6. glassfishrobot commented on Apr 25, 2017

    @glassfishrobot
    glassfishrobot
    on Apr 25, 2017
    Author
    More actions

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

  7. glassfishrobot
    added
    Type: New Feature
    Priority: Major
    on Apr 25, 2017
  8. glassfishrobot
    assigned
    ldemichiel
    on Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @ldemichiel
    ldemichiel

Labels

Priority: MajorType: New Feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.