Clone
Cédric Champeau
committed
on 20 May
Detect special multicause exceptions
This commit fixes an issue where test reports and build scans didn't capture
all the causes of an excep… Show more
Detect special multicause exceptions

This commit fixes an issue where test reports and build scans didn't capture

all the causes of an exception, in case the "multi-cause" exception isn't

a type known of the daemon. By that, we mean a type which is not available

at runtime in the daemon process, but is used in the worker process.

Typically, the `org.opentest4j.MultipleFailuresError` type used by

JUnit is such an example: the type is used in a test process, but

not loaded in Gradle. In such cases, Gradle builds a placeholder

exception type which collects the root cause. But in case the

exception is actually collecting multiple causes like in this test

class, Gradle lost some information in the process.

Therefore, this commit introduces a heuristic to figure out if an

exception is collecting multiple causes instead of a single one.

The heuristic is kept very simple: one has to find a method which

name is either `getCauses` (like for Gradle's own default multi

cause exception) or `getFailures` (like in opentest4j), and it

has to return a collection of failures.

This will not fix all problems but it should capture a good amount

of them.

Fixes #9487

Show less

master + 93 more