Enum Visibility

java.lang.Object
java.lang.Enum<Visibility>
com.google.errorprone.util.Visibility
All Implemented Interfaces:
Serializable, Comparable<Visibility>, java.lang.constant.Constable

public enum Visibility
extends Enum<Visibility>
implements Comparable<Visibility>
Describes visibilities available via VisibleForTesting annotations, and provides methods to establish whether a given Tree should be visible.
  • Enum Constant Details

    • NONE

      public static final Visibility NONE
    • PRIVATE

      public static final Visibility PRIVATE
    • PACKAGE_PRIVATE

      public static final Visibility PACKAGE_PRIVATE
    • PROTECTED

      public static final Visibility PROTECTED
    • PUBLIC

      public static final Visibility PUBLIC
  • Method Details

    • values

      public static Visibility[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Visibility valueOf​(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • shouldBeVisible

      public abstract boolean shouldBeVisible​(Tree tree, VisitorState state)
      Whether tree should be visible from the path in state assuming we're in prod code.
    • shouldBeVisible

      public abstract boolean shouldBeVisible​(com.sun.tools.javac.code.Symbol symbol, VisitorState state)
      Whether symbol should be visible from the path in state assuming we're in prod code.
    • fromModifiers

      public static Visibility fromModifiers​(Set<Modifier> modifiers)
    • isAtLeastAsRestrictiveAs

      public boolean isAtLeastAsRestrictiveAs​(Visibility visibility)
    • isMoreVisibleThan

      public boolean isMoreVisibleThan​(Visibility visibility)
    • description

      public abstract String description()
      A fragment describing this visibility, to fit in a phrase like "restricted to [...]".

      This is complicated by NONE, which doesn't describe a Java visibility.