Skip to content

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

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

copybara-service[bot] wants to merge 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.

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: 1015649267

This branch has not been deployed

No deployments
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