QDox

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
    30/Jul/04 9:43 AM
    6 kB
    Philippe Gaudin
  2. JavaSource.java
    30/Jul/04 6:57 AM
    6 kB
    Philippe Gaudin
  3. patch
    30/Jul/04 9:44 AM
    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
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.
Hide
Aslak Hellesoy added a comment -

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

Show
Aslak Hellesoy added a comment - could you provide the changed file(s) as a diff so we can see exactly what you changed?
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)

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: