Skip to content

Update metro to v0.10.0#1024

Merged
SorrowBlue merged 2 commits intomainfrom
renovate/metro
Jan 20, 2026
Merged

Update metro to v0.10.0#1024
SorrowBlue merged 2 commits intomainfrom
renovate/metro

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Jan 20, 2026

This PR contains the following updates:

Package Change Age Confidence
dev.zacsweers.metro 0.9.40.10.0 age confidence
dev.zacsweers.metro:dev.zacsweers.metro.gradle.plugin 0.9.40.10.0 age confidence
dev.zacsweers.metro:metrox-android 0.9.40.10.0 age confidence

Release Notes

ZacSweers/metro (dev.zacsweers.metro)

v0.10.0

Compare Source

2026-01-19

Behavior Changes
  • Enable contributesAsInject by default. See its docs for more details, but in short this means that @Inject is now optional on @ContributesBinding, @ContributesIntoSet, and @ContributesIntoMap annotated declarations.
    @​ContributesBinding(AppScope::class)
    // @&#8203;Inject // <-- now implicit!
    class TacoImpl(...) : Taco
  • [Gradle / FIR] Enable FIR hint generation by default on Kotlin 2.3.20-Beta1 or later.
    • By extension, this resolves Metro's most subscribed issue (#​460) by enabling cross-module contribution/aggregation features in non-jvm/android compilations 🎉.
    • Note that there is a separate known kotlinc issue around qualifier annotations that affects native builds and is targeted for 2.3.20-Beta2. Follow #​1556 for updates.
  • [Gradle / FIR] Enable top-level function injection by default on Kotlin 2.3.20-Beta1 or later.
  • [Gradle / FIR] Disable automatic transformation of providers to private + deprecate the option, as this results in less efficient code generation and somewhat unclear error messages. It's recommended to write a lint check in another static analysis tool if you want this, for example this implementation from slack-lints.
    • Metro may add an option for the inverse in the future. i.e., allow writing a private provider in source but then transform it to internal at compile-time.
New
  • Support Map<K, Lazy<V>> and Map<K, Provider<Lazy<V>> multibindings expressions.
  • [FIR/IR] Report diagnostics for unmatched exclusions and replacements during contribution merging. These are written to reportsDestination if enabled, and should be used for debugging only.
  • [IR / Gradle] Add new experimental enableSwitchingProviders option. If enabled, this changes code generation to use "switching providers" to defer classloading until a giving binding is actually requested.
    • This is analogous to Dagger's fastInit feature.
    • You should really only use this if you've benchmarked it and measured a meaningful difference, as it comes with the same tradeoffs (always holding a graph instance ref, etc.)
  • [IR / Gradle] Add an unusedGraphInputsSeverity option to report diagnostics for unused direct graph inputs. This includes any @Provides or @Includes parameters to graph factories or managed binding containers declared via the @DependencyGraph.includes annotation.
    • This is in addition to the existing reportsDestination-only diagnostic for unused bindings, but limited to bindings that we know are not reused elsewhere and can thus safely soft-enforce at compile-time.
    • This matches a similar feature in Dagger.
Enhancements
  • [IR] Restructure graph validation and generation to be separate phases, allowing for whole-graph validation before any code gen runs and better optimizing shared bindings across graph extension hierarchies.
  • [IR] Improve member injection error trace in graph validation.
    • Previously it would show something like this
      dev.zacsweers.metro.MembersInjector<test.FeatureScreen> is requested at
          [test.FeatureGraph] test.FeatureGraph#inject()
      
    • Now it will specify the injected type is being injected instead
      test.Dependency is requested at
          [test.FeatureGraph] test.FeatureScreen.dependency
      test.FeatureScreen is injected at
          [test.FeatureGraph] test.FeatureGraph#inject()
      
    • It now also reports the location at the exact member injection callable declaration, rather than the graph.
  • [IR] Validate parameter type keys on native builds to help clarify encounters with KT-83427. Example below:
    e: Mirror/create function parameter type mismatch:
      - Source:         com.example.navigation.NavigationProviders.navigationSerializationModule
      - Mirror param:   @&#8203;com.example.app.navigation.NavigationSerializers kotlin.collections.Set<kotlinx.serialization.modules.SerializersModule>
      - create() param: kotlin.collections.Set<kotlinx.serialization.modules.SerializersModule>
    
    This is a known bug in the Kotlin compiler, follow https://github.com/ZacSweers/metro/issues/1556
    
  • [IR] Avoid generating unnecessary Provider refcounts for bindings only used by graph injector functions.
  • [IR] When reporting graph failures in dynamic graphs, report the original call location in error reporting.
  • [IR] Optimize equals/hashCode in type keys. Benchmarks show a ~2% macro improvement.
  • [IR/Sharding] Rebalance shard groups after computing shard bindings.
  • [Gradle] Generalize support for sourcing default values from gradle/system properties + document.
Fixes
  • [FIR] Ensure hint functions generated by FIR hint generation match the visibility of the source contributor.
  • [FIR/IR] Always check for @Inject-annotated constructor even if class is annotated. This is important for the contributesAsInject feature, as it would previously always use the primary constructor in these cases.
  • [FIR/IR] Don't clear reports dir between FIR and IR compiler phases.
  • [IR] Never eagerly init graph extension impls (scoped or not).
  • [IR] Don't cache creator-less scoped graph extension impls in their parent graphs. This was initially implemented this way due to a misunderstanding to how Dagger generated subcomponents! Getters for graph extensions now always return new instances.
  • [IR] Check for open or final modality on classes first before searching for injectable constructors.
  • [IR] Mark all supertypes' member injections as dependencies of subtypes' member injections. That's a wordier way of saying that member-injecting a class Dog that extends Animal also depends on member-injected dependencies of Animal.
  • [IR] Don't process companion objects of graphs or binding containers independently of their parent classes.
  • [IR/Native] Work around Abstract function '___' is not implemented in non-abstract class 'Impl' info warnings from native compilations.
  • [IR/Dynamic Graphs] Always check if a key is replaced by a dynamic type key when building binding graphs. Previously, some bindings would be added even if a dynamic key was available, resulting in unexpected DuplicateBinding errors.
  • [IC] Record lookups of contributed classes when looking up hints from IR. Previously Metro only recorded a lookup of the generated hint function, which appears to not be enough for Kotlin 2.3.20.
  • [IC] Link IR-generated hint function files back to source class via expect-actual tracker to link their compilations. This fixes an edge case where simply changing a contribution scope (or removing it) could leave behind a stale hint file that downstream compilations would incidentally read.
Misc Changes
  • [IR] Already mentioned above, but worth calling out again — creator-less scoped graph extensions are no longer cached in their parent graphs. Accessors to this will always get new instances now.
  • [IR] Report log files reported from within graph generation now use snake-cased fully-qualified names of the impl graph as the file name suffix.
  • [IR] Do not report similar bindings when a missing binding has type kotlin.Any. In practice this reported all available bindings.
  • [interop-dagger] Update to Dagger 2.58.
  • [Docs] Publish kdocs for guice/jakarta/javax interop and metrox artifacts to doc site.
  • [Docs] Expand IDE support docs.
  • [Docs] Update adoption.md docs about subcomponents interop.
  • Test Kotlin 2.3.10-RC.
  • Test Kotlin 2.3.20-Beta1.
Contributors

Special thanks to the following contributors for contributing to this release!


Configuration

📅 Schedule: Branch creation - "before 3am" (UTC), 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.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added 🤖renovate 「Renovateによって作成された」[Created by Renovate] type: :dependabot:dependencies 「依存関係更新」[Dependency Updates] labels Jan 20, 2026
@renovate
Copy link
Copy Markdown
Contributor Author

renovate Bot commented Jan 20, 2026

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@SorrowBlue SorrowBlue merged commit 544b8bc into main Jan 20, 2026
21 checks passed
@SorrowBlue SorrowBlue deleted the renovate/metro branch January 20, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖renovate 「Renovateによって作成された」[Created by Renovate] type: :dependabot:dependencies 「依存関係更新」[Dependency Updates]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant