Add apiguardian-api runtime dependency to satisfy ART's internal runtime annotation loader #306
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Essentially,
@API
is added to most of the JUnit 5 annotations. This is an annotation from a library called "API Guardian", which declares aRUNTIME
visibility.For Android specifically, this visibility makes it eligible for native annotation scanning when calling
Class.isAnnotationPresent()
on any of the JUnit 5 annotations with that meta-annotation. The problem is that JUnit Jupier declares its transitive dependency as "compile-only", causing@API
to be absent at runtime. This creates a log statement every time an annotation is queried, causing very noisy logs.The fix is to submit API Guardian as a runtime-only dependency to the instrumentation core.
Refs:
https://github.com/junit-team/junit5/blob/70e33483530259edef1ab3c1ba12971ac3fc7db7/junit-platform-commons/src/main/java/org/junit/platform/commons/util/AnnotationUtils.java#L136C38-L136C57 https://cs.android.com/android/platform/superproject/main/+/main:art/runtime/dex/dex_file_annotations.cc;l=780-781
Resolves #291.