Closed bjkeller closed 7 years ago
A similar problem affects 14 classes in Commons Collections that have to be excluded from Toradocu-Randoop evaluation.
Also, not excluding private classes such as org.apache.commons.collections4.trie.AbstractPatriciaTrie
A possible (partial?) solution could be place the condition class in the a package with the same name of the target class' package. What do you think?
I think that makes sense.
In general, the goal is that the condition classes compile, so whatever makes that possible. This won't be directly possible when the condition method has parameter types that are private. So, when the target class is private, as in
private class CannotBeUsedDirectly {
void subjectMethod(int val) { ... }
}
or when one of the parameter types is a private member of the target class
public class CanBeUsed {
void subjectMethod(PrivateMember arg) { ... }
private class PrivateMember {...}
}
My guess is that you can lift these to a public supertype in the condition method (keeping the correct types in the JSON). There may be conditions that cannot be expressed properly, but, regardless, I think you should be prepared to drop some conditions because they cannot be made public.
Now Toradocu generates condition-checking methods only for non-private methods. Also, the condition-checking class has now the appropriate package definition (the package is the same as the target class).
Do we need additional checks for the parameter types of the condition-checking methods? In that case, can you provide me few example where the compilation of the condition-checking class fails because of the private type of the parameters?
I think this change should be sufficient, as i don't think it should be possible to compile the subject class with a parameter type with more restrictive access than the method.
This won't be an issue until issue #27 is fixed, but there is not enough information in org.toradocu.extractor.Type
to determine the package name of a member class. At the moment, since there cannot be an enclosing class, it is sufficient to take the prefix of the qualified name such that qualifiedName
is prefix + "." + name
.
I'm going to close this because the original issue is resolved.
Running Toradocu on
org.apache.commons.collections4.bidimap.TreeBidiMap
with--export-conditions
(onrandoop
branch) getwhere
checkNonNullComparable()
is aprivate
method of the class.Though, the condition class doesn't compile because
org.apache.commons.collections4.bidimap.TreeBidiMap.DataElement
is package private.