Open ariannab opened 6 years ago
The issue is caused by the way the JavadocExtractor class heuristically matches parameter types in source code with parameter types loaded by reflection. In particular, the issue is the following: The Javadoc extractor needs to match the constructor in source code:
IterationManager(int, Incrementor.MaxCountExceededCallback)
with either one of the following constructors loaded with reflection:
IterationManager(int, org.apache.commons.math3.util.IntegerSequence$Incrementor$MaxCountExceededCallback)
IterationManager(int,org.apache.commons.math3.util.Incrementor$MaxCountExceededCallback)
The current heuristic selects both, while only the second one should be selected.
To properly fix this we should resolve source code types correctly, checking the import statements. Javaparser symbol solver could actually help us: https://github.com/javaparser/javasymbolsolver.
Test case to reproduce the problem:
@Test
public void issue233() {
String[] toradocuArgs =
new String[] {
"--target-class",
"org.apache.commons.math3.util.IterationManager",
"--class-dir",
"src/test/resources/bin/commons-math3-3.6.1.jar",
"--source-dir",
"src/test/resources/src/commons-math3-3.6.1-src/src/main/java",
"--oracle-generation",
"false",
"--debug"
};
Toradocu.main(toradocuArgs);
}
On class
org.apache.commons.math3.util.IterationManager
, Toradocu fails and stop with the following error:We could include this in the non-blocking errors that do not stop the Toradocu analysis - in this case, excluding the problematic method from the analysis.