summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Arneson <jarneson@google.com>2014-10-08 14:42:29 -0700
committerJeff Arneson <jarneson@google.com>2014-10-14 16:33:31 -0700
commit9ee73fde5ad41d815ddfdc4e058cc5e49c81fe51 (patch)
tree8b2fc70ebd03af2f2944b45664d8a333138246ed
parent4e67d82e0697805122796afec21f46e544eb309c (diff)
downloadplatform_external_doclava-lollipop-dev.tar.gz
platform_external_doclava-lollipop-dev.tar.bz2
platform_external_doclava-lollipop-dev.zip
Inner classes export showAnnotations from their containing classlollipop-dev
Updated the makeHDF methods on ClassInfo to grab showAnnotations recursively from the containing classes if they exist. getAnnotationsIncludeOuters is the helper method to do this. Nothing was changed about deciding visibility of said inner classes, as it seems to work really well already. Change-Id: Idbe7a2ee8fd5c455bb08bb3e53424630ec772267 Bug: 17900353
-rw-r--r--src/com/google/doclava/ClassInfo.java30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/com/google/doclava/ClassInfo.java b/src/com/google/doclava/ClassInfo.java
index e8b1f89..add8270 100644
--- a/src/com/google/doclava/ClassInfo.java
+++ b/src/com/google/doclava/ClassInfo.java
@@ -1028,10 +1028,11 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco
data.setValue(base + ".deprecatedsince", getDeprecatedSince());
}
+ ArrayList<AnnotationInstanceInfo> showAnnos = getShowAnnotationsIncludeOuters();
AnnotationInstanceInfo.makeLinkListHDF(
data,
base + ".showAnnotations",
- showAnnotations().toArray(new AnnotationInstanceInfo[showAnnotations().size()]));
+ showAnnos.toArray(new AnnotationInstanceInfo[showAnnos.size()]));
setFederatedReferences(data, base);
}
@@ -1070,10 +1071,11 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco
data.setValue("class.abstract", "abstract");
}
+ ArrayList<AnnotationInstanceInfo> showAnnos = getShowAnnotationsIncludeOuters();
AnnotationInstanceInfo.makeLinkListHDF(
data,
"class.showAnnotations",
- showAnnotations().toArray(new AnnotationInstanceInfo[showAnnotations().size()]));
+ showAnnos.toArray(new AnnotationInstanceInfo[showAnnos.size()]));
// class info
String kind = kind();
@@ -1434,6 +1436,30 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco
return mShowAnnotations;
}
+ public ArrayList<AnnotationInstanceInfo> getShowAnnotationsIncludeOuters() {
+ ArrayList<AnnotationInstanceInfo> allAnnotations = new ArrayList<AnnotationInstanceInfo>();
+ ClassInfo cl = this;
+ while (cl != null) {
+ if (cl.showAnnotations() != null) {
+ // Don't allow duplicates into the merged list
+ for (AnnotationInstanceInfo newAii : cl.showAnnotations()) {
+ boolean addIt = true;
+ for (AnnotationInstanceInfo existingAii : allAnnotations) {
+ if (existingAii.type().name() == newAii.type().name()) {
+ addIt = false;
+ break;
+ }
+ }
+ if (addIt) {
+ allAnnotations.add(newAii);
+ }
+ }
+ }
+ cl = cl.containingClass();
+ }
+ return allAnnotations;
+ }
+
private MethodInfo matchMethod(ArrayList<MethodInfo> methods, String name, String[] params,
String[] dimensions, boolean varargs) {
for (MethodInfo method : methods) {