Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-631

Improve AnnotationLiteral for empty annotations

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Obsolete
    • Major
    • 2.1 (Discussion)
    • None
    • None
    • None

    Description

      Annotation hashCode() and equals() operations are fairly expensive as they always invoke getDeclaredMethods() even if there are no such. And getDeclaredMethods involves the SecurityManager + wrapper classes + Exception handling + + +
      That's horrible expensive.

      In OWB I improved this by introducing an own base class for dynamic annotations which do not have any members:
      https://github.com/apache/openwebbeans/blob/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/EmptyAnnotationLiteral.java

      The method returns a hardcoded String for toString(), returns hardcoded 0 as hashCode and the equals() method invokes the equals on the annotation type.

      We might support this improvements directly in the AnnotationLiteral class or introduce a similar 2nd class especially for empty annotations?

      Attachments

        Activity

          People

            Unassigned Unassigned
            struberg Mark Struberg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: