Skip to content

Catch LinkageError in addition to ClassNotFoundErrors.#2494

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
piper_949797644
Open

Catch LinkageError in addition to ClassNotFoundErrors.#2494
copybara-service[bot] wants to merge 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: 949797644
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