List of super interfaces only includes direct interfaces
Status: Beta
Brought to you by:
khurshid
The list of implemented/super interfaces only includes
interfaces that are directly implemented/inherited.
It should include the transitive closure of parent
interfaces
(rian.wouters@philips.com)
Logged In: NO
fix:
XMLGenerator.java,
method XMLGenerator.buildInterfaceList
replace
// build the list
Object[] sorted = sortList(interfaces.toArray());
by
// add transitive closure of super interfaces
{
int i = 0;
while (i < interfaces.size()) {
ClassDoc cd = (ClassDoc)
interfaces.get(i);
ClassDoc[] interfaceInterfaces =
cd.interfaces();
append(interfaces, interfaceInterfaces);
i++;
} }
// build the list
Object[] sorted = sortList(interfaces.toArray());
// remove duplicate values
{
// precondition: sorted does not contain null values
Object o = null;
int j = 0;
for (int i = 0; i < sorted.length; i++) {
if (sorted[i] != o && (o == null || !
o.equals(sorted[i]))) {
sorted[j] = sorted[i];
j++;
}
o = sorted[j];
}
Object[] tmp = new Object[j];
System.arraycopy(sorted, 0, tmp, 0, j);
sorted = tmp;
}
this also fixes the problem of duplicate interfaces in the
interface list
Logged In: NO
oops, there is a bug in the fix:
"o = sorted[j];" should be before "j++"
Logged In: NO
Since the sorted array is only used once,
a much easier fix to remove the duplicate values:
replace:
if (interfaceDoc == null) {
by
if (interfaceDoc == null || i > 0 && (interfaceDoc == sorted[i-1]
|| interfaceDoc.equals(sorted[i-1]))) {
(rian.wouters@philips.com)