Repository navigation
Enhancements
- [core] Stop copying and re-sorting each binding's dependencies when ordering the graph.
- [core] Store one copy of the encoded type for each unqualified binding key.
- [FIR] Skip formatting class and function names for FIR trace events when compiler tracing is disabled.
- [IR] Compare shared bindings only once when compiling graph extensions. This cut compile time from 43.5 s to 3.2 s on a 58-class test graph.
- [IDEA] The IDE's Plugins dialog and JetBrains Marketplace now list IDEA and core changes and credit contributors.
- [IDEA] Opening a second module with the same Metro options now reuses the existing graph index.
- [IDEA] Reading cached gutter icons and inlay hints no longer queues extra work for the index.
- [IDEA] Look up binding data once per file when drawing inlay hints.
- [IDEA] Avoid taking a second snapshot of the same Kotlin type when indexing a plain binding request or a map request.
- [IDEA] Stop copying the full batch of pending file edits each time another edit arrives.
Fixes
- [core] Include the graph accessor in missing-binding errors, even when the missing dependency is several constructors deep.
- [core] Generated set and map entries now have the same graph keys in the IDE and compiler reports, including entries from libraries.
- [core] Set and map entries declared as properties now use the property name in both the IDE and compiler reports.
- [core] Report a clear missing binding when a key like
Thing<String, *>names a generic@Injectclass. Previously, the compiler reported a missing binding for the class's raw type parameter, and the IDE resolved the key to the class. - [core] Fix unsigned qualifier arguments such as
@Id(4294967295u)appearing as-1in binding keys, reports, and error messages. - [Compiler] Preserve unrelated files when clearing old reports from
reportsDestination. - [FIR] Limit generated contribution providers to bindings declared for their scope. Previously when a class contributed bindings to multiple scopes, FIR exposed all of them in each scope. Each container now generates providers only for its own bindings.
- [FIR] Report abstract properties on
@AssistedFactoryand@DependencyGraph.Factoryat compile time. Reading one on an assisted factory could throwAbstractMethodError. - [FIR]
@ElementsIntoSetcould put lists in aSet<String>when a provider returnedBatch<String>andBatch<T>implementedList<List<T>>. Metro now reports a compile error. DeclareSet<List<String>>and returnbatch.toSet(). - [FIR/IR] Fix
@get:site targets for@OptionalBinding. - [FIR/IR] Fix a bug where a provider returning
Map<K, V>?could supplynullto a non-nullMap<K, V>accessor. - [FIR/IR] Fix a JVM compiler crash (
Function has no body) when a class has overloaded@Injectmethods such asaccept(Int)andaccept(String). - [FIR/IR] Fix a compiler crash when resolving bindings with star projections such as
Map<String, *>andLazy<*>. - [FIR/IR] Fix a compiler crash when a graph factory returns a specialized type such as
AppGraph<String>. - [IR] Record
@Injectmethods in declaration order in library metadata. Sorting them by name could swap two@Namedarguments of the same type when another module injected the class. - [IR] Fix a
ClassCastExceptionin generated factories that passed an@Providesmethod's extension receiver or context parameter in the argument slot for the graph. - [IR] Fix
@set:Injectwriting directly to the backing field and skipping the custom setter. - [IR] If a graph already exposed a provided
Map<String, String>, Metro could reuse it for aMap<String, () -> String>accessor. Metro now reports a missing binding for the second accessor. - [IR] Fix a
ClassCastExceptionwhen injecting a providedMap<Class<*>, V>withenableKClassToClassInteropenabled. Metro tried to convert keys that were already Java classes. - [IR] Fix a compiler crash when a generic dependency graph declares a scoped provider.
- [IR] Report a missing binding when a graph requests an unbound class with injected members. Previously, Metro could mistake a member injector for a binding for the class and crash during IR generation.
- [IR] Fix a
NoSuchMethodErrorwhencreateGraph()tried to call a suspend function synchronously to get an extension receiver (e.g.@Provides suspend fun next(): Intfor@Provides fun Int.twice(): Long). - [IR] Fix a compiler crash when two
@IntoSetor@IntoMapfunctions have names with the same hash code, such asprovideAaandprovideBB. - [IR] Fix a compiler crash when a graph extension adds an
@IntoMapentry to a map that its parent graph also contributes to. This happened when the parent's entry was a scoped@Providesfunction using@ClassKeywith no class argument. - [IR] Fix single-entry set multibindings that allowed mutation on non-JVM targets.
- [IR] Fix a compiler crash when a graph extension calls an inherited provider on a generic parent graph.
- [IR] Fix graph diagnostics that could go missing when two of them fell back to the same declaration. Their messages are now joined in one report.
- [IR] Fix a missing binding error when a compilation requests a qualified
@Injectclass or@AssistedFactoryboth with and without its qualifier. Previously, only the first request resolved. - [IR] Fix a JVM name clash between a graph accessor function such as
fun getFoo(): Fooand the getter that Metro generates for a sharedFoobinding. Before, the build failed with "Platform declaration clash" (Kotlin 2.4.10), or the graph class failed to load withClassFormatError(Kotlin 2.4.20). - [IR] Keep the scope on
@Providesfunctions in Dagger modules that come from another compilation. Previously, Metro treated these providers as unscoped and created a new instance on every request. - [IR] Fix how error messages such as duplicate binding errors print providers with parameters. The return type no longer wraps to its own line, and context parameters now print before
funorval. - [Gradle] The hidden dependency check no longer fails because of dependencies that only another source set in the same project uses. For example, adding test fixtures no longer makes the check report
main'simplementationdependencies. - [IDEA] Discard a file snapshot if its worker is canceled while reading it for the IDE index.
- [IDEA] After a lookup in the inactive graph browser, unrelated edits no longer trigger an index build.
- [IDEA] Selecting a module with Metro disabled no longer triggers index rebuilds in other modules on unrelated edits.
- [IDEA] The graph browser now finds graphs annotated through a Kotlin
typealias. Changing the alias updates the index without an edit to the graph. - [IDEA] When a missing parent interface appears, the graph browser picks up its inherited accessors without an edit to the graph.
- [IDEA] Graph accessors that refer to a missing Java class now resolve when the class appears.
- [IDEA] Fix false suspend errors in child graphs when a parent's generic binding recursively requests larger types.
- [IDEA] Adding an entry to a child graph's map no longer flags scoped entries inherited from the parent as duplicate keys.
- [IDEA] Graph validation now reports duplicate map keys when different annotations unwrap to the same value.
- [IDEA] A matching generic provider in a dynamic graph's container now overrides a static provider. An exact provider in the dynamic container still wins.
- [IDEA] Go to Metro Binding on a provider's extension receiver now jumps to the receiver's binding. It used to jump back to the provider itself.
- [IDEA] Pinning a graph no longer hides a generic provider's consumers from Find Usages or the gutter.
- [IDEA] Select in Metro now finds the generic provider in the graph browser when it supplies a concrete type.
- [IDEA] When graphs specialize an inherited generic parameter differently, its inlay hint now shows the implementation from the pinned graph.
- [IDEA] Find Usages on a generic provider returning a
SetorMapnow includes requests that use it. - [IDEA] In projects without graphs, Find Usages no longer lists consumers in modules that can't see the provider.
- [IDEA] In projects without graphs, Find Usages no longer reports consumers for generic providers when derived bindings are disabled.
- [IDEA] Resolve a qualified
@Injectclass or@AssistedFactoryfor a request with no qualifier, like the compiler does. Previously, graph validation reported a missing binding and editor navigation found no binding for the request.
Changes
- [core] Report a new
Metro/MultibindingConflicterror when aSetorMapkey has both a direct binding and multibinding contributions or a@Multibindsdeclaration. Previously, this compiled and Metro silently dropped the contributions, so code that compiled before can now fail.A graph extension's contributions to a@DependencyGraph interface AppGraph { val strings: Set<String> // Error: Metro/MultibindingConflict @Provides fun strings(): Set<String> = setOf("a") @Provides @IntoSet fun b(): String = "b" }
SetorMapthat its parent provides directly are an error too.A graph extension's own whole@DependencyGraph interface AppGraph { @Provides fun strings(): Set<String> = setOf("a") fun child(): ChildGraph } @GraphExtension interface ChildGraph { val strings: Set<String> // Error: Metro/MultibindingConflict @Provides @IntoSet fun b(): String = "b" }
SetorMapstill replaces its parent's contributions. - Test IntelliJ IDEA
2025.3.6.3,2026.1.5.2,2026.2.5.1,2026.3.0.1, and2026.3.1 RC. - Test Android Studio Rabbit 2 Patch 3, Rabbit 3 RC 2, and Stingray 1 Canary 4.
- [compat] Support Kotlin
2.5.0. Metro retains the Kotlin 2.5 dev adapters used by IntelliJ IDEA 2026.3 and Android Studio Stingray. - [compat] Support Kotlin
2.5.20-dev-6103.
Contributors
Special thanks to the following contributors for contributing to this release!
Consider sponsoring Metro's development
What's Changed
- Update dependency com.github.ajalt.clikt:clikt to v5.2.0 by @renovate[bot] in #3136
- Update dependency com.autonomousapps:graph-support to v0.15.0 by @renovate[bot] in #3135
- Update dependency com.github.ajalt.clikt:clikt-jvm to v5.2.0 by @renovate[bot] in #3137
- Update IDE version mappings by @ZacSweers in #3139
- Update Metro bootstrap to v1.6.0 by @renovate[bot] in #3138
- Update wire to v7.2.2 by @renovate[bot] in #3145
- Update dependency org.robolectric:robolectric to v4.18.1 by @renovate[bot] in #3144
- Update dependency com.github.ajalt.clikt:clikt-jvm to v5.2.1 by @renovate[bot] in #3143
- Update dependency zensical to v0.1.2 by @renovate[bot] in #3141
- Update dependency com.android.tools:r8 to v9.5.33 by @renovate[bot] in #3140
- Update dependency com.github.ajalt.clikt:clikt to v5.2.1 by @renovate[bot] in #3142
- Update IDE version mappings by @ZacSweers in #3146
- Update IDE version mappings by @ZacSweers in #3147
- Update dependency zensical to v0.1.3 by @renovate[bot] in #3156
- Update dependency pymdown-extensions to v13.1.2 by @renovate[bot] in #3154
- Update Gradle to v9.9.2 by @renovate[bot] in #3150
- Update dependency mkdocs-material to v9.8.2 by @renovate[bot] in #3149
- Update androidx.lifecycle to v2.11.1 by @renovate[bot] in #3148
- Fix fixture discovery, setup, and coverage in compiler tests by @ZacSweers in #3151
- Migrate most legacy compiler tests to compiler-tests by @ZacSweers in #3161
- Document how to run a single JVM box test by @ZacSweers in #3163
- Preserve extension-generated bindings across modules when omitting mirrors by @ZacSweers in #3162
- Update IDE version mappings by @ZacSweers in #3167
- Reuse functional test results and TestKit build scripts in CI by @ZacSweers in #3165
- Update dependency PyYAML to v6.0.4 by @renovate[bot] in #3164
- Fix binding and injection bugs and speed up graph compilation by @ZacSweers in #3166
- Update IDE version mappings by @ZacSweers in #3169
- Clear stale test failures when CI passes on retry by @ZacSweers in #3170
- Fix graph validation, navigation, and index refresh in IDEA by @ZacSweers in #3168
- Clean up stale TODOs by @ZacSweers in #3172
- Clean up stale TODOs by @ZacSweers in #3173
- Clean up stale TODOs by @ZacSweers in #3174
- Update dependency org.commonmark:commonmark to v0.33.0 by @renovate[bot] in #3171
- Docs refresh by @ZacSweers in #3176
- Update IDE version mappings by @ZacSweers in #3177
- Clean up stale TODOs by @ZacSweers in #3175
- Clean up stale TODOs by @ZacSweers in #3178
- Update dependency mkdocs-git-revision-date-localized-plugin to v1.7.1 by @renovate[bot] in #3181
- Small IR cleanups by @ZacSweers in #3179
- Fix scoped providers in generic graphs by @ZacSweers in #3180
- Clean up stale TODOs by @ZacSweers in #3182
- Remove the lock guard that never fires from BindsMirrorClassTransformer by @ZacSweers in #3183
- More small IR cleanups by @ZacSweers in #3184
- Small metro-common cleanups by @ZacSweers in #3185
- Move declaration read models out of the transformer files by @ZacSweers in #3190
- Split generateBindingCode into one function per binding kind by @ZacSweers in #3188
- Move the suspend parallelMap helpers to the IDEA plugin by @ZacSweers in #3192
- Clean up maven repo setup by @ZacSweers in #3199
- Replace the mutable maps in AssistedFactoryFirGenerator with a FIR cache by @ZacSweers in #3193
- Update IDE version mappings by @ZacSweers in #3200
- De-flake CI by @ZacSweers in #3203
- Update ktor monorepo to v3.6.2 by @renovate[bot] in #3205
- Update dependency Markdown to v3.11.4 by @renovate[bot] in #3204
- Replace the mutable ParentContext with its snapshot by @ZacSweers in #3186
- Run graph validation phases as loops over one state object per graph by @ZacSweers in #3189
- Batch graph diagnostics per element with one helper by @ZacSweers in #3195
- Run graph sort and cycle analysis on integer ids by @ZacSweers in #3194
- Remove the concurrent maps and locks that IR no longer needs by @ZacSweers in #3197
- Give IR its own unsynchronized lazy and remove the global memoize mode by @ZacSweers in #3198
- Copy the reachable adjacency in linear time when most keys are reachable by @ZacSweers in #3201
- Use int collections in the cycle and deferral analysis by @ZacSweers in #3202
- Group the map factory symbols by factory class by @ZacSweers in #3191
- Test kotlin 2.5.0-RC2 by @ZacSweers in #3206
- Add a Gradle Plugin Portal mirror by @ZacSweers in #3207
- Limit FIR contribution providers to their container's scope by @ZacSweers in #3209
- Report missing bindings for classes with injected members by @ZacSweers in #3208
- Update IDE version mappings by @ZacSweers in #3210
- Resolve some IDEA deprecations by @ZacSweers in #3211
- Update dependency mkdocs-git-revision-date-localized-plugin to v1.7.2 by @renovate[bot] in #3212
- Refresh graph data in IDEA validation tests that assert fresh cached results by @ZacSweers in #3217
- Restore the graph refresh mode after IDEA tests that enable automatic refresh by @ZacSweers in #3219
- Update 2.5.20 dev to 2.5.20-dev-6103 by @ZacSweers in #3218
- Stop limiting the override and local Maven repositories to Kotlin dev versions by @ZacSweers in #3223
- Update IDE version mappings by @ZacSweers in #3225
- Update kct to v0.15.0 by @renovate[bot] in #3224
- Resolve implicit class keys for scoped map entries inherited from a parent graph by @ZacSweers in #3216
- Update dependency com.android.tools:r8 to v9.5.34 by @renovate[bot] in #3226
- Fix report for star-projected generic
@Injectclass keys by @ZacSweers in #3227 - Gradle 9.9.3 by @ZacSweers in #3228
- Update Kotlin compile testing to v0.15.0 by @renovate[bot] in #3221
- Resolve IntelliJ Platform artifacts without asking Maven Central by @ZacSweers in #3229
- Fix a missing binding when an
@Injectclass is requested with and without its qualifier by @ZacSweers in #3231 - Generate compiler test suites at build time instead of checking them in by @ZacSweers in #3232
- Encode and render unsigned qualifier arguments as unsigned numbers by @ZacSweers in #3233
- Resolve a qualified
@Injectclass for requests with no qualifier in the IDEA plugin by @ZacSweers in #3235 - Report an error when a Set or Map key has both a whole binding and multibinding contributions by @ZacSweers in #3234
- Reserve JVM getter names of graph functions when Metro names binding properties by @IlyaGulya in #3236
- Read Scope annotations from external Dagger modules by @aglose in #3245
- Print provider parameters and context parameters on the right lines in diagnostics by @ZacSweers in #3246
- Fix hidden dependency false positive on test fixtures by @scottjasso in #3247
- Finalize kotlin 2.5.0 support by @ZacSweers in #3249
- Generalize hidden dependency checks for JVM source sets by @scottjasso in #3248
New Contributors
- @IlyaGulya made their first contribution in #3236
Full Changelog: 1.6.0...1.6.1