Hi,
I believe ClassInfo#getOverrideOrder() is incorrect for methods and should probably prefer methodInfos from direct super classes before any interface methods.
After a quick test, the current order does appear to be correct for fields / interface constants.
Tested with JDK 8 and JDK 17.
Example:
Class: java.io.DataOutputStream
Method "close":
ClassLoader.getSystemClassLoader().loadClass("java.io.DataOutputStream").getMethod("close")
-> Returns: public void java.io.FilterOutputStream.close() throws java.io.IOException
ClassGraph graph = new ClassGraph()
.enableClassInfo()
.enableMethodInfo()
.acceptClasses("java.io.DataOutputStream")
.enableSystemJarsAndModules();
try (ScanResult scan = graph.scan()) {
ClassInfo classInfo = scan.getClassInfo("java.io.DataOutputStream");
MethodInfoList closeMethods = classInfo.getMethodInfo("close");
for (MethodInfo closeMethod : closeMethods) {
System.out.println(closeMethod + " from " + closeMethod.getClassInfo().getName());
}
//For some reason, the classInfo.getMethodInfo() list contains the abstract close method as well?
}
prints
public abstract void close() throws java.io.IOException from java.io.Closeable
Expected output:
public void close() throws java.io.IOException from java.io.FilterOutputStream
Hi,
I believe ClassInfo#getOverrideOrder() is incorrect for methods and should probably prefer methodInfos from direct super classes before any interface methods.
After a quick test, the current order does appear to be correct for fields / interface constants.
Tested with JDK 8 and JDK 17.
Example:
Class: java.io.DataOutputStream
Method "close":
ClassLoader.getSystemClassLoader().loadClass("java.io.DataOutputStream").getMethod("close")-> Returns:
public void java.io.FilterOutputStream.close() throws java.io.IOExceptionprints
public abstract void close() throws java.io.IOException from java.io.CloseableExpected output:
public void close() throws java.io.IOException from java.io.FilterOutputStream