Commit 5479d77e authored by Elliott Hughes's avatar Elliott Hughes
Browse files

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
parent c677db71
......@@ -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"
+ ">");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment