-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Labels
Description
Consider the following interface file demoInterface.java, there is a inner interface called AnotherInterface.
package org.example;
public interface demoInterface {
interface AnotherInterface {
void anotherMethod();
void anotherMethod2();
void anotherMethod3();
}
}Now a class implements the above interface as below:
package org.example;
public class demoTest implements demoInterface {
public AnotherInterface fakeMethod() {
return null;
}
}When QDox parses the fakeMethod(), it cannot correctly get the method infomration.
The parsing code is:
JavaProjectBuilder builder = new JavaProjectBuilder();
builder.addSourceTree(${path_to_org_example_package});
JavaClass javaClass = builder.getClassByName("org.example.demoTest");
// iterate all the methods
for (JavaMethod method : javaClass.getMethods()) {
JavaClass returnClass = method.getReturns();
if (returnClass != null) {
System.out.println("Class: " + returnClass.getFullyQualifiedName());
System.out.println("Method: " + method.getName() + " returns: " + returnClass.getFullyQualifiedName());
System.out.println(returnClass.getMethods());
}
}You will see the output:
Class: AnotherInterface
Method: fakeMethod returns: AnotherInterface
[]
The expected output should be:
Class: org.example.demoInterface.AnotherInterface
Method: fakeMethod returns: org.example.demoInterface.AnotherInterface
[public void anotherMethod(), public void anotherMethod2(), public void anotherMethod3()]