Package org.gradle.api.problems
Interface ProblemReporter
Defines different ways to report problems.
- Since:
- 8.6
-
Method Summary
Modifier and TypeMethodDescriptioncreate(ProblemId problemId, Action<? super ProblemSpec> action) Creates a new problem without reporting it immediately.voidreport(Collection<? extends Problem> problems) Reports the target problems.voidReports the target problem.voidreport(ProblemId problemId, Action<? super ProblemSpec> spec) Configures and reports a new problem.throwing(Throwable exception, Collection<? extends Problem> problems) Reports the target problems and throws a runtime exception.Configures a new problem, reports it, and uses it to throw a new exception.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
Creates a new problem without reporting it immediately. The created problem can be later reported withreport(Problem).- Parameters:
problemId- The problem idaction- The problem configuration.- Returns:
- The new problem.
- Since:
- 8.13
-
report
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 idspec- the problem configuration- Since:
- 8.13
-
report
Reports the target problem.- Parameters:
problem- The problem to report.- Since:
- 8.13
-
report
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 problemsproblemId- the problem idspec- the problem configuration- Returns:
- never returns by throwing the exception, but using
throwstatement at the call site is encouraged to indicate the intent and benefit from local control flow. - Since:
- 8.13
-
throwing
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 problemsproblem- the problem to report- Returns:
- never returns by throwing the exception, but using
throwstatement at the call site is encouraged to indicate the intent and benefit from local control flow. - Since:
- 8.13
-
throwing
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 problemsproblems- the problems to report- Returns:
- nothing, the method throws an exception
- Since:
- 8.13
-