QDox
  1. QDox
  2. QDOX-63

Inner classes not resolved in method parameters

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5, 1.6
    • Fix Version/s: 1.6
    • Component/s: Java API
    • Labels:
      None
    • Number of attachments :
      4

      Description

      I have a very simple class containing an inner class :

      package com.bsb.package1;

      public class Class2 {

      public static final class InnerClass {
      }
      }

      In another class I use the inner class as a method parameter :

      package com.bsb;

      import com.bsb.package1.Class2;

      public class Class1 {
      public void testMethod(Class2.InnerClass param) {
      }
      }

      • After a build of the source tree, the result of method.getDeclarationSignature(true) is :

      public void testMethod(Class2.InnerClass param)

      • The problem is that that the name of the class of the parameter is NOT fully qualified.
      • BUT if I add the (useless) explicit import of the inner class (i.e. import com.bsb.package1.Class2.InnerClass then the result is :

      public void testMethod(com.bsb.package1.Class2.InnerClass param)

      ... which is correct.

      1. JavaSource.java
        6 kB
        Philippe Gaudin
      2. JavaSource.java
        6 kB
        Philippe Gaudin
      3. patch
        0.6 kB
        Philippe Gaudin

        Activity

        Hide
        Philippe Gaudin added a comment -

        The very simple test case

        Show
        Philippe Gaudin added a comment - The very simple test case
        Philippe Gaudin made changes -
        Field Original Value New Value
        Attachment src.zip [ 12670 ]
        Hide
        Philippe Gaudin added a comment -

        I could correct the problem !

        The problem was in method resolveTypeInternal of JavaSource. When trying to resolve as an inner class, if the parent of the inner class was imported (without wildcard), it didn't try to find the class in the class library.

        The updated JavaSource.java is in attachement. Please check it and, if OK, integrate it to QDox. Maybe a specific test could be usefull.

        Show
        Philippe Gaudin added a comment - I could correct the problem ! The problem was in method resolveTypeInternal of JavaSource. When trying to resolve as an inner class, if the parent of the inner class was imported (without wildcard), it didn't try to find the class in the class library. The updated JavaSource.java is in attachement. Please check it and, if OK, integrate it to QDox. Maybe a specific test could be usefull.
        Philippe Gaudin made changes -
        Attachment JavaSource.java [ 12691 ]
        Hide
        Aslak Hellesøy added a comment -

        could you provide the changed file(s) as a diff so we can see exactly what you changed?

        Show
        Aslak Hellesøy added a comment - could you provide the changed file(s) as a diff so we can see exactly what you changed?
        Philippe Gaudin made changes -
        Attachment JavaSource.java [ 12693 ]
        Philippe Gaudin made changes -
        Attachment patch [ 12694 ]
        Hide
        Philippe Gaudin added a comment -

        pacth loaded

        Show
        Philippe Gaudin added a comment - pacth loaded
        Hide
        Philippe Gaudin added a comment -

        ... and the correct version of JavaSource.java loaded (I couldn't delete the other one)

        Show
        Philippe Gaudin added a comment - ... and the correct version of JavaSource.java loaded (I couldn't delete the other one)
        Mike Williams made changes -
        Fix Version/s 1.6 [ 10814 ]
        Assignee Mike Williams [ mdub ]
        Joe Walnes made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Mike Williams
            Reporter:
            Philippe Gaudin
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: