Skip to content

Catch LinkageError in addition to ClassNotFoundErrors. - #2494

Merged
copybara-service[bot] merged 1 commit into
mainfrom
piper_949797644
Jul 27, 2026
Merged

Catch LinkageError in addition to ClassNotFoundErrors.#2494
copybara-service[bot] merged 1 commit into
mainfrom
piper_949797644

Conversation

@copybara-service

Copy link
Copy Markdown

Catch LinkageError in addition to ClassNotFoundErrors.

TestRequestBuilder uses Class.forName to load the legacy
Suppress annotation and other annotation classes.

The call sites currently only catch ClassNotFoundException, but according
to the reference docs Class.forName can also throw LinkageError
e.g. NoClassDefFoundError.

There has been a report of TestRequestBuilder.maybeAddLegacySuppressFilter throwing a fatal NoClassDefFoundError when used with AGP 9.4.0-alpha03. See issuetracker bug 536117227

To make androidx.test.runner more resilient to class loading issues,
this commit expands the catch block to also catch Linkage errors

TestRequestBuilder uses Class.forName to load the legacy
Suppress annotation and other annotation classes.

The call sites currently  only catch ClassNotFoundException, but according
to the reference docs Class.forName can also throw LinkageError
e.g. NoClassDefFoundError.

There has been a report of TestRequestBuilder.maybeAddLegacySuppressFilter throwing a fatal NoClassDefFoundError when used with AGP 9.4.0-alpha03. See issuetracker bug 536117227

To make androidx.test.runner more resilient to class loading issues,
this commit expands the catch block to also catch Linkage errors

PiperOrigin-RevId: 954713113
@copybara-service
copybara-service Bot merged commit a029b36 into main Jul 27, 2026
@copybara-service
copybara-service Bot deleted the piper_949797644 branch July 27, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant