Class ErrorProneOptions

java.lang.Object
net.ltgt.gradle.errorprone.ErrorProneOptions

public abstract class ErrorProneOptions extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    check(String checkName, CheckSeverity severity)
    Adds a check with a given severity.
    void
    check(String checkName, org.gradle.api.provider.Provider<CheckSeverity> severity)
    Adds a check with a given severity.
    final void
    check(kotlin.Pair<String,CheckSeverity>... pairs)
    Adds pairs of check name to severity.
    void
    disable(String... checkNames)
    Disable checks.
    void
    enable(String... checkNames)
    Adds checks with their default severity.
    void
    error(String... checkNames)
    Adds checks with error severity.
    abstract org.gradle.api.provider.Property<Boolean>
    Enables all Error Prone checks, checks that are disabled by default are enabled as warnings; maps to -XepAllDisabledChecksAsWarnings.
    abstract org.gradle.api.provider.Property<Boolean>
    Turns all Error Prone errors into warnings; maps to -XepAllErrorsAsWarnings.
    abstract org.gradle.api.provider.Property<Boolean>
    Turn all Error Prone suggestions into warnings; maps to -XepAllSuggestionsAsWarnings.
    abstract org.gradle.api.provider.MapProperty<String,String>
    A map of check options to their value.
    abstract org.gradle.api.provider.MapProperty<String,CheckSeverity>
    A map of check name to CheckSeverity, to configure which checks are enabled or disabled, and their severity.
    abstract org.gradle.api.provider.Property<Boolean>
    Tells Error Prone that the compilation contains only test code; maps to -XepCompilingTestOnlyCode.
    abstract org.gradle.api.provider.Property<Boolean>
    Disable all Error Prone checks; maps to -XepDisableAllChecks.
    abstract org.gradle.api.provider.Property<Boolean>
    Disables all Error Prone warnings; maps to -XepDisableAllWarnings.
    abstract org.gradle.api.provider.Property<Boolean>
    Disables warnings in classes annotated with javax.annotation.processing.Generated or @javax.annotation.Generated; maps to -XepDisableWarningsInGeneratedCode.
    abstract org.gradle.api.provider.Property<Boolean>
    Allows disabling Error Prone altogether for the task.
    abstract org.gradle.api.provider.ListProperty<String>
    Additional arguments passed to Error Prone.
    List<org.gradle.process.CommandLineArgumentProvider>
    A list of CommandLineArgumentProvider for additional arguments passed to Error Prone.
    abstract org.gradle.api.provider.Property<String>
    A regular expression pattern (as a string) of file paths to exclude from Error Prone checking; maps to -XepExcludedPaths.
    abstract org.gradle.api.provider.Property<Boolean>
    Ignores suppression annotations, such as @SuppressWarnings; maps to -XepIgnoreSuppressionAnnotations.
    abstract org.gradle.api.provider.Property<Boolean>
    Tells Error Prone to ignore unknown check names in checks; maps to -XepIgnoreUknownCheckNames.
    void
    option(String name)
    Adds a check option with a true boolean value.
    void
    option(String name, boolean value)
    Adds a check option with a given boolean value.
    void
    option(String name, String value)
    Adds a check option with a given value.
    void
    option(String name, org.gradle.api.provider.Provider<String> value)
    Adds a check option with a given value.
    static void
    option$default(ErrorProneOptions options, String name, boolean unusedBoolean, int unusedInt, Object unusedObject)
    Deprecated.
    Kept only for kotlin binary backward-compatibility.
     
    void
    warn(String... checkNames)
    Adds checks with warning severity.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • ErrorProneOptions

      public ErrorProneOptions()
  • Method Details

    • getEnabled

      @Input public abstract org.gradle.api.provider.Property<Boolean> getEnabled()
      Allows disabling Error Prone altogether for the task.

      Error Prone will still be in the annotation processor path, but -Xplugin:ErrorProne won't be passed as a CompileOptions.getCompilerArgs() compiler argument}.

      Defaults to true on tasks for source sets, false otherwise.

    • getDisableAllChecks

      @Input public abstract org.gradle.api.provider.Property<Boolean> getDisableAllChecks()
      Disable all Error Prone checks; maps to -XepDisableAllChecks.

      This will be the first argument, so checks can then be re-enabled on a case-by-case basis.

    • getDisableAllWarnings

      @Input public abstract org.gradle.api.provider.Property<Boolean> getDisableAllWarnings()
      Disables all Error Prone warnings; maps to -XepDisableAllWarnings.

      This will be among the first arguments, so checks can then be re-enabled on a case-by-case basis.

    • getAllErrorsAsWarnings

      @Input public abstract org.gradle.api.provider.Property<Boolean> getAllErrorsAsWarnings()
      Turns all Error Prone errors into warnings; maps to -XepAllErrorsAsWarnings.

      This will be among the first arguments, so checks can then be promoted back to error on a case-by-case basis.

    • getAllSuggestionsAsWarnings

      @Input public abstract org.gradle.api.provider.Property<Boolean> getAllSuggestionsAsWarnings()
      Turn all Error Prone suggestions into warnings; maps to -XepAllSuggestionsAsWarnings.

      This will be among the first arguments, so checks can then be demoted back to suggestions on a case-by-case basis.

    • getAllDisabledChecksAsWarnings

      @Input public abstract org.gradle.api.provider.Property<Boolean> getAllDisabledChecksAsWarnings()
      Enables all Error Prone checks, checks that are disabled by default are enabled as warnings; maps to -XepAllDisabledChecksAsWarnings.

      This will be among the first arguments, so checks can then be disabled again on a case-by-case basis.

    • getDisableWarningsInGeneratedCode

      @Input public abstract org.gradle.api.provider.Property<Boolean> getDisableWarningsInGeneratedCode()
      Disables warnings in classes annotated with javax.annotation.processing.Generated or @javax.annotation.Generated; maps to -XepDisableWarningsInGeneratedCode.
    • getIgnoreUnknownCheckNames

      @Input public abstract org.gradle.api.provider.Property<Boolean> getIgnoreUnknownCheckNames()
      Tells Error Prone to ignore unknown check names in checks; maps to -XepIgnoreUknownCheckNames.
    • getIgnoreSuppressionAnnotations

      @Input public abstract org.gradle.api.provider.Property<Boolean> getIgnoreSuppressionAnnotations()
      Ignores suppression annotations, such as @SuppressWarnings; maps to -XepIgnoreSuppressionAnnotations.
    • getCompilingTestOnlyCode

      @Input public abstract org.gradle.api.provider.Property<Boolean> getCompilingTestOnlyCode()
      Tells Error Prone that the compilation contains only test code; maps to -XepCompilingTestOnlyCode.

      Defaults to true for a source set inferred as a test source set, false otherwise.

    • getExcludedPaths

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getExcludedPaths()
      A regular expression pattern (as a string) of file paths to exclude from Error Prone checking; maps to -XepExcludedPaths.
    • getChecks

      @Input public abstract org.gradle.api.provider.MapProperty<String,CheckSeverity> getChecks()
      A map of check name to CheckSeverity, to configure which checks are enabled or disabled, and their severity.

      Maps each entry to -Xep:<key>:<value>, or -Xep:<key> when the value is CheckSeverity.DEFAULT.

      See Also:
    • getCheckOptions

      @Input public abstract org.gradle.api.provider.MapProperty<String,String> getCheckOptions()
      A map of check options to their value.

      Use an explicit "true" value for a boolean option.

      Maps each entry to -XepOpt:<key>=<value>.

      See Also:
    • getErrorproneArgs

      @Input public abstract org.gradle.api.provider.ListProperty<String> getErrorproneArgs()
      Additional arguments passed to Error Prone.
    • getErrorproneArgumentProviders

      public List<org.gradle.process.CommandLineArgumentProvider> getErrorproneArgumentProviders()
      A list of CommandLineArgumentProvider for additional arguments passed to Error Prone.
    • check

      @SafeVarargs public final void check(kotlin.Pair<String,CheckSeverity>... pairs)
      Adds pairs of check name to severity.

      Equivalent to calling check(first, second) for each pair.

      See Also:
    • check

      public void check(String checkName, CheckSeverity severity)
      Adds a check with a given severity.

      Equivalent to checks.put(checkName, severity).

      See Also:
    • check

      public void check(String checkName, org.gradle.api.provider.Provider<CheckSeverity> severity)
      Adds a check with a given severity.

      Equivalent to checks.put(checkName, severity).

      See Also:
    • enable

      public void enable(String... checkNames)
      Adds checks with their default severity.

      Useful in combination with disableAllChecks to selectively re-enable checks.

      Equivalent to calling check(checkName, CheckSeverity.DEFAULT) for each check name.

      See Also:
    • disable

      public void disable(String... checkNames)
      Disable checks.

      Equivalent to calling check(checkName, CheckSeverity.OFF) for each check name.

      See Also:
    • warn

      public void warn(String... checkNames)
      Adds checks with warning severity.

      Equivalent to calling check(checkName, CheckSeverity.WARN) for each check name.

      See Also:
    • error

      public void error(String... checkNames)
      Adds checks with error severity.

      Equivalent to calling check(checkName, CheckSeverity.ERROR) for each check name.

      See Also:
    • option

      public void option(String name)
      Adds a check option with a true boolean value.

      Equivalent to checkOptions.put(name, "true").

      See Also:
    • option$default

      @Deprecated @Deprecated(message="Kept only for kotlin binary backward-compatibility", level=HIDDEN) public static void option$default(ErrorProneOptions options, String name, boolean unusedBoolean, int unusedInt, Object unusedObject)
      Deprecated.
      Kept only for kotlin binary backward-compatibility.
    • option

      public void option(String name, boolean value)
      Adds a check option with a given boolean value.

      Equivalent to checkOptions.put(name, String.valueOf(value)).

      See Also:
    • option

      public void option(String name, String value)
      Adds a check option with a given value.

      Equivalent to checkOptions.put(name, value).

      See Also:
    • option

      public void option(String name, org.gradle.api.provider.Provider<String> value)
      Adds a check option with a given value.

      Equivalent to checkOptions.put(name, value).

      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object