QDox
  1. QDox
  2. QDOX-129

Inconsistency between getMethods(), getFields() in binary and source JavaClass

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.6, 1.7
    • Fix Version/s: 1.7
    • Component/s: Java API
    • Labels:
      None
    • Testcase included:
      yes
    • Patch Submitted:
      Yes
    • Number of attachments :
      1

      Description

      JavaClass created from a binary java.lang.Class rather than the source does not provide access to non public methods, fields, or constructors, whereas the JavaClass created from the source does.

      I have attached a patch that provides test cases and fixes for this situation. It also adds a test to highlight the inconsistency between source and binary due to the lack of default constructor in the former and inability to differentiate it from a normal public no arg constructor in the latter.

      Basically the fix is to use clazz.getDeclaredMethods() instead of clazz.getMethods() which also removes the need for excluding inherited methods as getDeclaredMethods() does not return inherited methods. Similar fixes are required for fields and constructors.

      The supplied patch was created against the trunk but can also be applied to QDOX_1_6_3.

      Is there any chance that this can be applied to 1.6.3 to create 1.6.4 as it is a blocker for me.

        Activity

        Dennis Lundberg made changes -
        Field Original Value New Value
        Fix Version/s 1.6 [ 10814 ]
        Hide
        Paul Hammant added a comment -

        fixed. thanks for patch

        Show
        Paul Hammant added a comment - fixed. thanks for patch
        Paul Hammant made changes -
        Assignee Paul Hammant [ paul ]
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Paul Hammant
            Reporter:
            Paul Duffin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: