Enum ThirdPartyLibrary

java.lang.Object
java.lang.Enum<ThirdPartyLibrary>
tech.picnic.errorprone.bugpatterns.util.ThirdPartyLibrary
All Implemented Interfaces:
Serializable, Comparable<ThirdPartyLibrary>, java.lang.constant.Constable

public enum ThirdPartyLibrary extends Enum<ThirdPartyLibrary>
Utility class that helps decide whether it is appropriate to introduce references to (well-known) third-party libraries.

This class should be used by BugCheckers that may otherwise suggest the introduction of code that depends on possibly-not-present third-party libraries.

  • Enum Constant Details

  • Method Details

    • values

      public static ThirdPartyLibrary[] 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 ThirdPartyLibrary 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
    • isIntroductionAllowed

      public boolean isIntroductionAllowed(com.google.errorprone.VisitorState state)
      Tells whether it is okay to introduce a dependency on this well-known third party library in the given context.
      Parameters:
      state - The context under consideration.
      Returns:
      true iff it is okay to assume or create a dependency on this library.