0.10.4
Enhancements
- [FIR]: Add suspicious scope diagnostics for cases where a developer might accidentally try to contribute to a concrete
@Scopeclass or graph-like class, as that's not usually what you want! - [FIR]: Add a diagnostic error for function member injection parameters with default values as they are not currently supported.
- [IR]: Extend conflicting overrides diagnostic in synthetic graphs (graph extension impls, dynamic graphs) to also validate compatible annotations. This catches scenarios where you may accidentally contribute something like a
fun dependency(): Dependencyaccessor and@Provides fun dependency(): Dependencyprovider elsewhere, which previously resulted in undefined runtime behavior. - [IR]: When reporting conflicting override types in synthetic graphs, underline the type and include the source location (when possible) to better indicate the issue.
- [IR]: Add a graph validation failure hint to report when a direct Map binding exists that cannot satisfy a Provider/Lazy map.
-
For example, the below snippet
@DependencyGraph interface ExampleGraph { val mapSize: Int @Provides fun provideInt(map: Map<String, Provider<String>>): Int = map.size @DependencyGraph.Factory interface Factory { fun create(@Provides map: Map<String, String>): ExampleGraph } }
Now yields this error trace
error: [Metro/MissingBinding] Cannot find an @Inject constructor or @Provides-annotated function/property for: kotlin.collections.Map<kotlin.String, kotlin.String> kotlin.collections.Map<kotlin.String, kotlin.String> is injected at [ExampleGraph] ExampleGraph.provideInt(…, map) kotlin.Int is requested at [ExampleGraph] ExampleGraph.mapSize (Hint) A directly-provided 'Map<String, String>' binding exists, but direct Map bindings cannot satisfy 'Map<String, Provider<String>>' requests. IncompatibleMapValueType.kt:15:16 @Provides map: kotlin.collections.Map<kotlin.String, kotlin.String> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Provider/Lazy-wrapped map values (e.g., Map<K, Provider<V>>) only work with a Map **multibinding** created with `@IntoMap` or `@Multibinds`.
-
Fixes
- [IR]: Gracefully handle skipping code gen for absent member-injected properties/single-arg setters.
- [IR]: Decompose
Mapgraph factory inputs correctly so they can properly satisfy map requests on the graph. - [IR]: Validate directly-provided map inputs from map-requesting injection sites.
- [IR/Native]: Fix mirror parameter check for providers in
objectclasses in non-jvm compilations.
Changes
- Deprecate the
generateThrowsAnnotationsoption and make it no-op. This was only in place when debugging a past kotlin/native issue.
Contributors
Special thanks to the following contributors for contributing to this release!
What's Changed
- Deprecate/clean up generateThrowsAnnotation by @ZacSweers in #1798
- Enable enableGraphSharding by default by @ZacSweers in #1799
- Update compose.jb to v1.10.1 by @renovate[bot] in #1800
- Beef up tests by @ZacSweers in #1802
- Add suspicious scope warning by @ZacSweers in #1803
- Update dependency pillow to v12.1.1 by @renovate[bot] in #1804
- Update dependency androidx.collection:collection to v1.6.0-rc01 by @renovate[bot] in #1807
- Update dependency androidx.activity:activity-compose to v1.12.4 by @renovate[bot] in #1806
- (temp) Revert "Enable enableGraphSharding by default" until 0.11 by @ZacSweers in #1811
- Extra test for nullable scoped bindings + revamp test docs by @ZacSweers in #1812
- Validate compatible annotations in synthetic graph overrides by @scana in #1810
- Fix mirror parameter check for providers in
objectclasses by @ZacSweers in #1813 - Clean up member injections with default values by @ZacSweers in #1814
- Tweak clashing declarations message by @ZacSweers in #1817
- Update IDE version mappings by @ZacSweers in #1819
- Update alias refreshing by @ZacSweers in #1820
- Fix mapping graph map inputs by @ZacSweers in #1818
New Contributors
Full Changelog: 0.10.3...0.10.4