8000 Implement proxy interface for `@AssistedFactory` in FastInit mode. by copybara-service[bot] · Pull Request #5346 · google/dagger · GitHub
[go: up one dir, main page]

Skip to content

Implement proxy interface for @AssistedFactory in FastInit mode. - #5346

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_1018206561
Open

copybara-service[bot] wants to merge 1 commit into
masterfrom
test_1018206561

Conversation

@copybara-service
Copy link
Copy Markdown

Implement proxy interface for @AssistedFactory in FastInit mode.

In FastInit mode, when an @AssistedFactory interface or return type is package-private or Kotlin
internal, Dagger's component (which may be in a different package) cannot directly instantiate
an anonymous implementation of the factory.

To fix this Dagger generates [FactoryName]_Proxy, an interface in the factory's package containing:

  • An abstract proxy method with inaccessible types erased to Object
  • A public static createFactory([FactoryName]_Proxy proxy) helper method returning the factory implementation masked

The generated Component in FastInit mode delegates to [FactoryName]_Proxy.createFactory(...)
using an anonymous proxy implementation that doesn't require referencing
the non-public types.

RELNOTES=Add assisted factory proxy to bypass visibility issues

In FastInit mode, when an `@AssistedFactory` interface or return type is package-private or Kotlin
internal, Dagger's component (which may be in a different package) cannot directly instantiate
an anonymous implementation of the factory.

To fix this Dagger generates `[FactoryName]_Proxy`, an interface in the factory's package containing:
- An abstract proxy method with inaccessible types erased to `Object`
- A public static `createFactory([FactoryName]_Proxy proxy)` helper method returning the factory implementation masked

The generated Component in FastInit mode delegates to `[FactoryName]_Proxy.createFactory(...)`
using an anonymous proxy implementation that doesn't require referencing
the non-public types.

RELNOTES=Add assisted factory proxy to bypass visibility issues
PiperOrigin-RevId: 1018206561

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

0