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

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_1018206561
Nov 20, 2026
Merged

copybara-service[bot] merged 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

@copybara-service
copybara-service Bot force-pushed the test_1018206561 branch 2 times, most recently from 8721f8e to 391bf18 Compare November 20, 2026 13:49
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: 1026425008
@copybara-service
copybara-service Bot merged commit 9624950 into master Nov 20, 2026
4 checks passed
@copybara-service
copybara-service Bot deleted the test_1018206561 branch November 20, 2026 14:15
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