Skip to content

Add missing @RestrictTo(Scope.LIBRARY) annotations in AndroidX Test. - #2533

Merged
copybara-service[bot] merged 1 commit into
mainfrom
piper_1015649267
Nov 9, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
piper_1015649267

Conversation

@copybara-service

Copy link
Copy Markdown

Add missing @RestrictTo(Scope.LIBRARY) annotations in AndroidX Test.

Annotate three internal androidx.test declarations that previously
relied only on @hide Javadoc tags:

  • InstrumentationParameterUtil
    (androidx.test.internal.platform.util)
  • ProcSummary (androidx.test.internal.util)
  • PortForwardingRule.Builder (androidx.test.rule, whose enclosing
    @RestrictTo(Scope.LIBRARY_GROUP) class is included in
    current_internal.txt)

Neither androidx.test.internal.platform.util nor
androidx.test.internal.util can use a package-level
@RestrictTo(Scope.LIBRARY) package-info.java because both packages
also export @RestrictTo(Scope.LIBRARY_GROUP) APIs in monitor's
current_internal.txt.

Adding explicit @RestrictTo annotations instead of relying on @hide
doc tags:

  • Unlocks passing --ignore-comments on API signature generation,
    improving build performance and memory usage by skipping Javadoc/KDoc
    extraction, comment AST parsing, and {@link} import caching.
  • Enables Metalava declarative <api-surfaces> XML configuration,
    which ignores @hide and @removed Javadoc tags by design.
  • Enforces visibility statically in compilers, Android Lint, Dackka,
    and IDEs.

@copybara-service
copybara-service Bot force-pushed the piper_1015649267 branch 4 times, most recently from c034c5b to fff7ed7 Compare November 9, 2026 18:53
Annotate three internal `androidx.test` declarations that previously
relied only on `@hide` Javadoc tags:
- `InstrumentationParameterUtil`
  (`androidx.test.internal.platform.util`)
- `ProcSummary` (`androidx.test.internal.util`)
- `PortForwardingRule.Builder` (`androidx.test.rule`, whose enclosing
  `@RestrictTo(Scope.LIBRARY_GROUP)` class is included in
  `current_internal.txt`)

Neither `androidx.test.internal.platform.util` nor
`androidx.test.internal.util` can use a package-level
`@RestrictTo(Scope.LIBRARY)` `package-info.java` because both packages
also export `@RestrictTo(Scope.LIBRARY_GROUP)` APIs in `monitor`'s
`current_internal.txt`.

Adding explicit `@RestrictTo` annotations instead of relying on `@hide`
doc tags:
- Unlocks passing `--ignore-comments` on API signature generation,
  improving build performance and memory usage by skipping Javadoc/KDoc
  extraction, comment AST parsing, and `{@link}` import caching.
- Enables Metalava declarative `<api-surfaces>` XML configuration,
  which ignores `@hide` and `@removed` Javadoc tags by design.
- Enforces visibility statically in compilers, Android Lint, Dackka,
  and IDEs.

PiperOrigin-RevId: 1017491093
@copybara-service
copybara-service Bot merged commit 3028afb into main Nov 9, 2026
3 checks passed
@copybara-service
copybara-service Bot deleted the piper_1015649267 branch November 9, 2026 19:13
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