Skip to content

Update Dagger to be stricter about wildcard types.#5151

Merged
copybara-service[bot] merged 1 commit intomasterfrom
test_894284536
Apr 9, 2026
Merged

Update Dagger to be stricter about wildcard types.#5151
copybara-service[bot] merged 1 commit intomasterfrom
test_894284536

Conversation

@copybara-service
Copy link
Copy Markdown

Update Dagger to be stricter about wildcard types.

The change in aosp/4011581 will be a breaking change for Dagger because type arguments will no longer implement XType, instead they will implement XTypeArgument which contains both a XVariance and an XType. This means that wildcard types need to be handled explicitly.

This CL adds checks to Dagger's codebase that will make migrating to the new API easier. In particular, this CL adds XTypes.checkInvariantType and XTypes.getInvariantType() that wrap type arguments to make it explicit whether we require the type argument to be invariant or whether the variance just isn't important and we can ignore it.

The plan for migration will be:

  1. submit this CL
  2. submit aosp/4011581
  3. submit CL/892735159

RELNOTES=N/A

The change in aosp/4011581 will be a breaking change for Dagger because type arguments will no longer implement `XType`, instead they will implement `XTypeArgument` which contains both a `XVariance` and an `XType`. This means that wildcard types need to be handled explicitly.

This CL adds checks to Dagger's codebase that will make migrating to the new API easier. In particular, this CL adds `XTypes.checkInvariantType` and `XTypes.getInvariantType()` that wrap type arguments to make it explicit whether we require the type argument to be invariant or whether the variance just isn't important and we can ignore it.

The plan for migration will be:

  1. submit this CL
  2. submit aosp/4011581
  3. submit CL/892735159

RELNOTES=N/A
PiperOrigin-RevId: 897352928
@copybara-service copybara-service bot merged commit 6113471 into master Apr 9, 2026
@copybara-service copybara-service bot deleted the test_894284536 branch April 9, 2026 23:12
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