Skip to content

1.4.3

Latest

Choose a tag to compare

@ZacSweers ZacSweers released this 08 Sep 04:27
· 8 commits to main since this release

Enhancements

  • [FIR] Warn when a @ContributesTo interface only exposes bindings and recommend making it a binding container with @BindingContainer. The latter is preferable as it reduces generated code.
  • [FIR] Warn about array class literals in qualifiers, map keys, and scopes that kotlinc can confuse across modules. For example, Array<IntArray>::class can be read as IntArray::class.
  • [FIR/IR] Support priority on @ContributesBinding and @ContributesIntoMap, allowing higher-priority contributions to replace conflicting bindings or map entries without directly referencing the lower-priority implementation.
  • [IR] Reuse completed member-injector lookups for classes without injectable members.
  • [IR] Support suspend providers with switching providers.
  • [IR] Avoid revisiting shared supertypes when resolving generic bindings through diamond inheritance.
  • [IR] Reduce per-entry memory overhead in more long-lived graph and contribution caches by using scatter maps.
  • [IR] Reduce repeated work when validating suspend multibindings and reporting suspend-binding errors. Error traces now use cached, deterministic shortest paths to a suspend binding.
  • [IR] Reduce repeated dependency scans when checking cycles in graphs with large multibindings.
  • [IR] Avoid initializing the rich terminal renderer for plain compiler diagnostics.
  • [IR/interop] Support Hilt interop when IR class generation is enabled.
  • [Reports] Explain binding choices in graph reports. Includes things like selection precedence, contribution filtering, and parent-graph ownership.
  • [Reports] Count emitted provider inlines in graph reports.
  • [Reports] Report when deferred access or unavailable values prevent provider inlining.

Fixes

  • [FIR] Fix a compiler crash when using typealiases as contribution scopes.
  • [FIR] Fix a compiler crash on zero-parameter member-injection functions.
  • [FIR] Fix graphs accidentally implementing binding-container interfaces when contributions use different scopes. Basically, checking another scope won't turn a container that supplies bindings into an interface the graph implements.
  • [FIR] Keep contributed graph accessors when their replacement or its origin is excluded.
  • [FIR] Avoid annotation-cache races during concurrent IDE analysis.
  • [FIR] Fix assisted factories whose return types nest or reorder factory type parameters.
  • [FIR/IR/interop] Fix recognition of @get:BindsOptionalOf properties when Dagger interop is enabled.
  • [IR] Keep dynamic graph arguments aligned when container order changes.
  • [IR] Prevent dynamic graph class name collisions when a generic binding container is used with different type arguments. Basically, graphs using Bindings<Int> and Bindings<Long> can coexist in the same file.
  • [IR] Avoid generated dynamic graph name collisions across sibling files.
  • [IR] Keep all transitively included binding containers when multiple graphs enter the same include cycle from different containers. Basically, improve compiler caching when containers are used in multiple graphs.
  • [IR] Resolve graph extension bindings before running parallel graph analysis. This keeps compiler lookups and cache writes on one thread, including for nested extensions and bindings loaded from dependencies.
  • [IR] Report required dependencies when an earlier parameter has a default value for the same missing type.
  • [IR] Fix a runtime crash when an assisted-injected class with no assisted parameters is used across modules with IR class generation.
  • [IR] Restore primitive and string inline provider values from dependency metadata.
  • [IR] Report an error when an assisted-injected constructor requests a set or eager map backed by suspend providers. Basically, assisted factories now get the same suspend-multibinding checks as ordinary injection.
  • [IR] Fix a compiler crash when reading @Binds declarations from generic binding containers.
  • [IR] Fix @Binds resolution when multiple graphs use the same generic binding container with different type arguments. Each graph now resolves bindings using its own container's type arguments.
  • [IR] Fix missing bindings for internal contributed objects across modules when generateContributionProviders, generateClassesInIr, and contributesAsInject are enabled together.
  • [IR] Report duplicate map keys when different key annotations unwrap to the same value, including implicit class keys.
  • [IR] Apply contribution replacements only in the scopes that declare them.
  • [IR] Report missing required graph bindings even when an @OptionalBinding accessor requests the same type, regardless of declaration order.
  • [IR] Compare annotation values structurally so hash collisions don't merge distinct bindings.
  • [IR] Preserve JVM array component types and dimensions in source class-literal qualifiers.
  • [IR] Resolve JVM binary annotation defaults on Kotlin 2.3.0 and 2.3.10.
  • [IR/interop] Fix Class-keyed maps wrapped in providers or lazy values when KClass/Class interop is enabled.
  • [IR/interop] Fix a runtime ClassCastException when a Class-keyed map is injected into a provider-created class across modules with KClass/Class interop enabled.
  • [IR/interop] Respect @GraphPrivate on Dagger @BindsOptionalOf declarations inherited by graph extensions, while preserving public declarations for the same key.
  • [IR/interop] Preserve Kotlin nullability in member-injection metadata when Dagger interop is enabled.

Changes

  • [IR] Annotation default matching is limited for KLIB dependencies on Kotlin 2.3.0 and 2.3.10. We recommend upgrading to Kotlin 2.3.20 or newer.
  • Build against Kotlin 2.4.20. Note the runtime artifacts still target Kotlin 2.3.0 and Metro supports a wide range of compiler versions. See the compatibility docs for a full table of compatible versions.
  • Update embedded Okio dependency to 3.18.2.
  • Raise Kotlin 2.5.0 support to 2.5.0-dev-4967 for IntelliJ 2026.3 EAPs. This replaces the 2.5.0-dev-498 and 2.5.0-dev-3513 compat modules.
  • Test Kotlin 2.5.0-dev-6460.
  • Test Kotlin 2.4.20.
  • Test Kotlin 2.4.20-RC2.
  • Test Kotlin 2.4.20-RC3.
  • Test IntelliJ 2026.2.2.
  • Test IntelliJ 2026.3 EAPs (263.3889.65).
  • Test Android Studio Quail 4.
  • Test Android Studio Rabbit canaries (canary 4).

Contributors

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

Consider sponsoring Metro's development

What's Changed

Full Changelog: 1.4.2...1.4.3