From 7d8874353e7eba22548b256f5ffb1e07bdb3c142 Mon Sep 17 00:00:00 2001 From: Omari Stephens Date: Fri, 14 Aug 2015 18:46:45 -0700 Subject: Add a flag to control the annotated field visibility exception Bug: 8440225 Bug: 22723877 Change-Id: I4621b993cb958e7e5ca29b1a02530844f87abb68 --- src/com/google/doclava/Doclava.java | 6 ++++++ src/com/google/doclava/MemberInfo.java | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java index e2f7d88..23ede5f 100644 --- a/src/com/google/doclava/Doclava.java +++ b/src/com/google/doclava/Doclava.java @@ -90,6 +90,7 @@ public class Doclava { public static HashSet knownTags = new HashSet(); public static FederationTagger federationTagger = new FederationTagger(); public static Set showAnnotations = new HashSet(); + public static boolean showAnnotationOverridesVisibility = false; public static Set hiddenPackages = new HashSet(); public static boolean includeDefaultAssets = true; private static boolean generateDocs = true; @@ -213,6 +214,8 @@ public class Doclava { keepListFile = a[1]; } else if (a[0].equals("-showAnnotation")) { showAnnotations.add(a[1]); + } else if (a[0].equals("-showAnnotationOverridesVisibility")) { + showAnnotationOverridesVisibility = true; } else if (a[0].equals("-hidePackage")) { hiddenPackages.add(a[1]); } else if (a[0].equals("-proguard")) { @@ -589,6 +592,9 @@ public class Doclava { if (option.equals("-showAnnotation")) { return 2; } + if (option.equals("-showAnnotationOverridesVisibility")) { + return 1; + } if (option.equals("-hidePackage")) { return 2; } diff --git a/src/com/google/doclava/MemberInfo.java b/src/com/google/doclava/MemberInfo.java index da11360..2d4a682 100644 --- a/src/com/google/doclava/MemberInfo.java +++ b/src/com/google/doclava/MemberInfo.java @@ -145,14 +145,16 @@ public abstract class MemberInfo extends DocInfo implements Comparable, Scoped { /** * Returns {@code true} if the member's scope is above the minimum requested scope passed to - * Doclava, or if the member is tagged with an annotation which was specified in a - * "-showAnnotation" argument to Doclava + * Doclava. Provided that the {@code -showAnnotationOverridesVisibility} argument was passed to + * Doclava, this will also return {@code true} if the member is tagged with an + * annotation which was specified in a {@code -showAnnotation} argument to Doclava */ public boolean checkLevel() { if (Doclava.checkLevel(mIsPublic, mIsProtected, mIsPackagePrivate, mIsPrivate, isHiddenOrRemoved())) { return true; - } else if (mShowAnnotations != null && !mShowAnnotations.isEmpty()) { + } else if (Doclava.showAnnotationOverridesVisibility && + mShowAnnotations != null && !mShowAnnotations.isEmpty()) { return true; } -- cgit v1.2.3