Package org.gradle.api.problems

# Interface ProblemReporter

@Incubating public interface ProblemReporter
Defines different ways to report problems.

Since:
  8.6

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Problem`
  `create(ProblemId problemId, Action<? super ProblemSpec> action)`
  Creates a new problem without reporting it immediately.
  `void`
  `report(Collection<? extends Problem> problems)`
  Reports the target problems.
  `void`
  `report(Problem problem)`
  Reports the target problem.
  `void`
  `report(ProblemId problemId, Action<? super ProblemSpec> spec)`
  Configures and reports a new problem.
  `RuntimeException`
  `throwing(Throwable exception, Collection<? extends Problem> problems)`
  Reports the target problems and throws a runtime exception.
  `RuntimeException`
  `throwing(Throwable exception, Problem problem)`
  Configures a new problem, reports it, and uses it to throw a new exception.
  `RuntimeException`
  `throwing(Throwable exception, ProblemId problemId, Action<? super ProblemSpec> spec)`
  Configures a new problem, reports it, and uses it to throw a new exception.

- ## Method Details

  - ### create

    Problem create(ProblemId problemId, Action<? super ProblemSpec> action)
    Creates a new problem without reporting it immediately. The created problem can be later reported with `report(Problem)`.
    Parameters:
      `problemId` - The problem id
      `action` - The problem configuration.
    Returns:
      The new problem.
    Since:
      8.13

  - ### report

    void report(ProblemId problemId, Action<? super ProblemSpec> spec)
    Configures and reports a new problem.

    The spec must specify the problem label and the category. Any additional configuration is optional.

    Parameters:
      `problemId` - the problem id
      `spec` - the problem configuration
    Since:
      8.13

  - ### report

    void report(Problem problem)
    Reports the target problem.
    Parameters:
      `problem` - The problem to report.
    Since:
      8.13

  - ### report

    void report(Collection<? extends Problem> problems)
    Reports the target problems.
    Parameters:
      `problems` - The problems to report.
    Since:
      8.13

  - ### throwing

    RuntimeException throwing(Throwable exception, ProblemId problemId, Action<? super ProblemSpec> spec)
    Configures a new problem, reports it, and uses it to throw a new exception.

    An exception must be provided in the spec.

    The spec must specify the exception, the problem label, and the category. Any additional configuration is optional.

    Parameters:
      `exception` - the exception to throw after reporting the problems
      `problemId` - the problem id
      `spec` - the problem configuration
    Returns:
      never returns by throwing the exception, but using `throw` statement at the call site is encouraged to indicate the intent and benefit from local control flow.
    Since:
      8.13

  - ### throwing

    RuntimeException throwing(Throwable exception, Problem problem)
    Configures a new problem, reports it, and uses it to throw a new exception.

    An exception must be provided in the spec.

    The spec must specify the exception, the problem label, and the category. Any additional configuration is optional.

    Parameters:
      `exception` - the exception to throw after reporting the problems
      `problem` - the problem to report
    Returns:
      never returns by throwing the exception, but using `throw` statement at the call site is encouraged to indicate the intent and benefit from local control flow.
    Since:
      8.13

  - ### throwing

    RuntimeException throwing(Throwable exception, Collection<? extends Problem> problems)
    Reports the target problems and throws a runtime exception. When this method is used, all reported problems will be associated with the thrown exception.
    Parameters:
      `exception` - the exception to throw after reporting the problems
      `problems` - the problems to report
    Returns:
      nothing, the method throws an exception
    Since:
      8.13