Work around a bug with <T> ... <? extends T[]> methods.

Java 6 adds an Arrays.copyOf method that confuses droiddoc into producing
a class "Array" in the anonymous package. I've raised a bug for someone
to work out why and fix this properly (after spending a fairly fruitless
afternoon on it). This work-around filters that out the cruft. I've checked
the generated current.xml file and the generated java.util.Arrays stubs,
and they're both correct. The extent of droiddoc's confusion appears to be
limited to inventing a non-existent class. (My guess is that it doesn't
realize that the element type of the array is a type parameter, not a type,
and it ends up using a default type name of "Array" from somewhere [javadoc
itself?].)

Bug: 2715505
Change-Id: I2ad7ecc819e320a1d209720b3dfbef45bbd89877
This commit is contained in:
Elliott Hughes 2010-05-25 20:17:20 -07:00
parent c677db71e8
commit 5479d77e32
1 changed files with 11 additions and 0 deletions

View File

@ -315,6 +315,12 @@ public class Stubs {
return;
}
// Work around the bogus "Array" class we invent for
// Arrays.copyOf's Class<? extends T[]> newType parameter. (http://b/2715505)
if (cl.containingPackage() != null && cl.containingPackage().name().equals("")) {
return;
}
String filename = stubsDir + '/' + javaFileName(cl);
File file = new File(filename);
ClearPage.ensureDirectory(file);
@ -788,6 +794,11 @@ public class Stubs {
HashSet notStrippable) {
ClassInfo[] classes = classList.toArray(new ClassInfo[classList.size()]);
Arrays.sort(classes, ClassInfo.comparator);
// Work around the bogus "Array" class we invent for
// Arrays.copyOf's Class<? extends T[]> newType parameter. (http://b/2715505)
if (pack.name().equals("")) {
return;
}
xmlWriter.println("<package name=\"" + pack.name() + "\"\n"
//+ " source=\"" + pack.position() + "\"\n"
+ ">");