jaxb
  1. jaxb
  2. JAXB-784

JAnnotationUse should provide getters for clazz and memberValues properties

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 2.2.4
    • Component/s: runtime
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      Currently there is no way to learn the annotation class and annotation
      parameters from JAnnotationUse class. Class should have getters for it's members.

        Activity

        Hide
        Martin Grebac added a comment -

        reassigning

        Show
        Martin Grebac added a comment - reassigning
        Hide
        Martin Grebac added a comment -

        fixed in codemodel build, will commit when proxy gets back up

        Show
        Martin Grebac added a comment - fixed in codemodel build, will commit when proxy gets back up
        Hide
        Dmitry Katsubo added a comment -

        I have NullPointerException with current implementation. This is because when memberValues is null and getAnnotationMembers() is called, it crashes:

        Caused by: java.lang.NullPointerException
        	at java.util.Collections$UnmodifiableMap.<init>(Collections.java:1274)
        	at java.util.Collections.unmodifiableMap(Collections.java:1260)
        	at com.sun.codemodel.JAnnotationUse.getAnnotationMembers(JAnnotationUse.java:73)
        

        getAnnotationMembers() should have a protection against this situation.

        Show
        Dmitry Katsubo added a comment - I have NullPointerException with current implementation. This is because when memberValues is null and getAnnotationMembers() is called, it crashes: Caused by: java.lang.NullPointerException at java.util.Collections$UnmodifiableMap.<init>(Collections.java:1274) at java.util.Collections.unmodifiableMap(Collections.java:1260) at com.sun.codemodel.JAnnotationUse.getAnnotationMembers(JAnnotationUse.java:73) getAnnotationMembers() should have a protection against this situation.
        Hide
        AndreasZ added a comment -

        The Current implementation is quite useless because you can't get the actual value. The JAnnotationValue class should provide at least a getter for the value that was passed to the param-Method.

        Show
        AndreasZ added a comment - The Current implementation is quite useless because you can't get the actual value. The JAnnotationValue class should provide at least a getter for the value that was passed to the param-Method.
        Hide
        Dmitry Katsubo added a comment -

        AndreasZ, what you mean I believe I have already reported as JAXB-878.

        Show
        Dmitry Katsubo added a comment - AndreasZ , what you mean I believe I have already reported as JAXB-878 .
        Hide
        Dmitry Katsubo added a comment -

        NPE is now forked as JAXB-1040. This simple problem was not solved within two yeas.

        Show
        Dmitry Katsubo added a comment - NPE is now forked as JAXB-1040 . This simple problem was not solved within two yeas.

          People

          • Assignee:
            Martin Grebac
            Reporter:
            dma_k
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: