Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.6.9->0.7.20.6.9->0.7.2Release Notes
ZacSweers/metro (dev.zacsweers.metro)
v0.7.2Compare Source
2025-10-22
Lazy-wrapped multibindings.v0.7.1Compare Source
2025-10-21
🚨 This release has a severe bug in multibinding code gen, please use 0.7.2 instead!
New: Add missing dependency hints for missing bindings errors
Enhancement: Improve code generation around multibinding collection builders and contributors, using more lazy getters in graph code gen.
Enhancement: Short-circuit empty map providers to
emptyMap().Enhancement: Support default values for assisted parameter arguments in top-level function injection.
Enhancement: Allow using
@Contributes*annotations on assisted factories withcontributesAsInjectenabled.Enhancement: Allow
@OptionalBindingannotation to be customizable/replaceable.Change: Deprecate
@OptionalDependencyin favor of@OptionalBinding. Same behavior, just a slightly more consistent name.Fix: Compute
Optionalinstance lazily when requested as aProvider<Optional<T>>and the underlying optional is not empty. Only applies to@BindsOptionalOfinterop.Fix: Don't generate duplicate
init()functions when chunking initializers if graphs already have an explicitinit()function.Fix: Fix support for assisted inject with no assisted params.
Fix: Detect platform types in just the
kotlinpackage. Previously it missed any that didn't have multiple package segments.Fix: Align unused context parameter special names on Kotlin 2.3.x.
Remove
2.3.0-dev-7984compat (superseded by2.3.0-Beta1).Special thanks to @Lavmee, @kevinguitar, and @jackwilsdon for contributing to this release!
v0.7.0Compare Source
2025-10-17
Dynamic Graphs
Dynamic graphs are a powerful new feature of the Metro compiler that allows for dynamically replacing bindings in a given graph. To use them, you can pass in a vararg set of binding containers to the
createDynamicGraph()andcreateDynamicGraphFactory()intrinsics.This is particularly useful for tests. See their docs for more information: Dynamic Graphs.
This API is experimental and may change in the future, please report any issues you encounter!
Implicit
@Injectbehavior on (most)@Contributes*-annotated typesUp to this point, Metro has always required you to use
@Injecton most@Contributes*annotated types. However, this can feel a bit repetitive and tedious. In this release, there is a newcontributesAsInjectoption that can be enabled that will treat all@Contributes*annotated types as@Injectby default. You can still use@Injecton classes to be explicit, and if you have multiple constructors you must still use@Injecton the constructor you want to be used.The only exception to this is
@ContributesTo, which isn't applicable to injected types.This is disabled by default to start but will likely become the default in a future release.
Other Changes
assistedInjectMigrationSeverityDSL. You must now move fully to using@AssistedInjectannotations for assisted types.@Providesdeclarations. This means you could, for example, write a provider like so:@AssistedInject-annotated classes.wasmWasitargets to Metro's runtime.interopAnnotationsNamedArgSeverityoption.@Originannotations.getContainingClassSymbol()(fixes Kotlin 2.3.0-x compatibility).Optionalbinding fields.BindingLookup.innerclasses.IncompatiblyScopedBindingshint.Optionaltypes, avoiding accidental eager initialization in cycles.REDUNDANT_PROVIDES.Special thanks to @erawhctim and @CharlieTap for contributing to this release!
v0.6.10Compare Source
2025-10-11
Optional Dependency Behaviors
Graph accessors can now expose optional dependencies, just use
@OptionalDependencyon the accessor. Note that the accessor must declare a default body that Metro will use if the dependency is absent.There are a couple of optional configuration for Metro's optional dependency support that can be configured via the
optionalDependencyBehaviorGradle DSL:DISABLED- Disallows optional dependencies entirely.REQUIRE_OPTIONAL_DEPENDENCY- Requires optional dependency parameters to also be annotated with@OptionalDependency. This may be preferable for consistency with accessors and/or explicitness.DEFAULT- The default behavior as described above — accessors must be annotated with@OptionalDependencywith default bodies and parameters just use default value expressions.Other changes
@BindsOptionalOf. Note this is currently only limited tojava.util.Optional.IrErrorTypeencounters.statementsPerInitFunto option to control the number of statements per init function. Only for advanced/debugging use.@Includestypes themselves (i.e., not their accessors) to be dependencies in generated graphs.@Providesbody diagnostics rather than returning early.openmembers from abstract graph class superclasses to be accessors.openmodality as well.Special thanks to @ChristianKatzmann for contributing to this release!
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.