summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2017-04-21 11:13:42 -0600
committerJeff Sharkey <jsharkey@android.com>2017-04-21 11:14:01 -0600
commit46fcac9c47b14e2199465960aab9f2f47e5e9737 (patch)
treead7e6111d72b052d0a1b5d15d1d00aea0135df25
parentd85b5c88af45b60592e816029c316ec29a3af43d (diff)
downloadplatform_external_doclava-46fcac9c47b14e2199465960aab9f2f47e5e9737.tar.gz
platform_external_doclava-46fcac9c47b14e2199465960aab9f2f47e5e9737.tar.bz2
platform_external_doclava-46fcac9c47b14e2199465960aab9f2f47e5e9737.zip
Look for SuppressAutoDoc in more places.
It can appear on parameters, members, or classes. Test: builds Bug: 37526420 Change-Id: Ib390fb2af3cfdf2904c140b6aa69f0453230bea3
-rw-r--r--src/com/google/doclava/AuxUtils.java49
-rw-r--r--src/com/google/doclava/FieldInfo.java2
-rw-r--r--src/com/google/doclava/MethodInfo.java6
3 files changed, 44 insertions, 13 deletions
diff --git a/src/com/google/doclava/AuxUtils.java b/src/com/google/doclava/AuxUtils.java
index ebed942..cfa668c 100644
--- a/src/com/google/doclava/AuxUtils.java
+++ b/src/com/google/doclava/AuxUtils.java
@@ -21,18 +21,35 @@ import java.util.HashMap;
import java.util.List;
public class AuxUtils {
- public static final int TYPE_METHOD = 0;
- public static final int TYPE_FIELD = 1;
- public static final int TYPE_PARAM = 2;
- public static final int TYPE_RETURN = 3;
+ private static final int TYPE_METHOD = 0;
+ private static final int TYPE_FIELD = 1;
+ private static final int TYPE_PARAM = 2;
+ private static final int TYPE_RETURN = 3;
- public static TagInfo[] tags(int type, List<AnnotationInstanceInfo> annotations) {
+ public static TagInfo[] fieldAuxTags(FieldInfo field) {
+ if (hasSuppress(field)) return TagInfo.EMPTY_ARRAY;
+ return auxTags(TYPE_FIELD, field.annotations());
+ }
+
+ public static TagInfo[] methodAuxTags(MethodInfo method) {
+ if (hasSuppress(method)) return TagInfo.EMPTY_ARRAY;
+ return auxTags(TYPE_METHOD, method.annotations());
+ }
+
+ public static TagInfo[] paramAuxTags(MethodInfo method, ParameterInfo param) {
+ if (hasSuppress(method)) return TagInfo.EMPTY_ARRAY;
+ if (hasSuppress(param.annotations())) return TagInfo.EMPTY_ARRAY;
+ return auxTags(TYPE_PARAM, param.annotations());
+ }
+
+ public static TagInfo[] returnAuxTags(MethodInfo method) {
+ if (hasSuppress(method)) return TagInfo.EMPTY_ARRAY;
+ return auxTags(TYPE_RETURN, method.annotations());
+ }
+
+ private static TagInfo[] auxTags(int type, List<AnnotationInstanceInfo> annotations) {
ArrayList<TagInfo> tags = new ArrayList<>();
for (AnnotationInstanceInfo annotation : annotations) {
- if (annotation.type().qualifiedName().equals("android.annotation.SuppressAutoDoc")) {
- return TagInfo.EMPTY_ARRAY;
- }
-
ParsedTagInfo[] docTags = ParsedTagInfo.EMPTY_ARRAY;
switch (type) {
case TYPE_METHOD:
@@ -117,4 +134,18 @@ public class AuxUtils {
}
return tags.toArray(TagInfo.getArray(tags.size()));
}
+
+ private static boolean hasSuppress(MemberInfo member) {
+ return hasSuppress(member.annotations())
+ || hasSuppress(member.containingClass().annotations());
+ }
+
+ private static boolean hasSuppress(List<AnnotationInstanceInfo> annotations) {
+ for (AnnotationInstanceInfo annotation : annotations) {
+ if (annotation.type().qualifiedName().equals("android.annotation.SuppressAutoDoc")) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/src/com/google/doclava/FieldInfo.java b/src/com/google/doclava/FieldInfo.java
index 3b8c676..e7897c8 100644
--- a/src/com/google/doclava/FieldInfo.java
+++ b/src/com/google/doclava/FieldInfo.java
@@ -331,7 +331,7 @@ public class FieldInfo extends MemberInfo {
data.setValue(base + ".anchor", anchor());
TagInfo.makeHDF(data, base + ".shortDescr", firstSentenceTags());
TagInfo.makeHDF(data, base + ".descr", inlineTags());
- TagInfo.makeHDF(data, base + ".descrAux", AuxUtils.tags(AuxUtils.TYPE_FIELD, annotations()));
+ TagInfo.makeHDF(data, base + ".descrAux", AuxUtils.fieldAuxTags(this));
TagInfo.makeHDF(data, base + ".deprecated", comment().deprecatedTags());
TagInfo.makeHDF(data, base + ".seeAlso", comment().seeTags());
data.setValue(base + ".since", getSince());
diff --git a/src/com/google/doclava/MethodInfo.java b/src/com/google/doclava/MethodInfo.java
index 1e92dff..63c72c4 100644
--- a/src/com/google/doclava/MethodInfo.java
+++ b/src/com/google/doclava/MethodInfo.java
@@ -505,7 +505,7 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv
}
// Collect all docs requested by annotations
- TagInfo[] auxTags = AuxUtils.tags(AuxUtils.TYPE_PARAM, param.annotations());
+ TagInfo[] auxTags = AuxUtils.paramAuxTags(this, param);
// Okay, now add the collected parameter information to the method data
mParamTags[i] =
@@ -616,7 +616,7 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv
TagInfo.makeHDF(data, base + ".shortDescr", firstSentenceTags());
TagInfo.makeHDF(data, base + ".descr", inlineTags());
- TagInfo.makeHDF(data, base + ".descrAux", AuxUtils.tags(AuxUtils.TYPE_METHOD, annotations()));
+ TagInfo.makeHDF(data, base + ".descrAux", AuxUtils.methodAuxTags(this));
TagInfo.makeHDF(data, base + ".blockTags", blockTags());
TagInfo.makeHDF(data, base + ".deprecated", deprecatedTags());
TagInfo.makeHDF(data, base + ".seeAlso", seeTags());
@@ -635,7 +635,7 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv
data.setValue(base + ".scope", "public");
}
TagInfo.makeHDF(data, base + ".returns", returnTags());
- TagInfo.makeHDF(data, base + ".returnsAux", AuxUtils.tags(AuxUtils.TYPE_RETURN, annotations()));
+ TagInfo.makeHDF(data, base + ".returnsAux", AuxUtils.returnAuxTags(this));
if (mTypeParameters != null) {
TypeInfo.makeHDF(data, base + ".generic.typeArguments", mTypeParameters, false);