interface Component1 {
val string: String
}
@Component
abstract class TestComponent : Component1 {
@Provides
fun provideString(): String = ""
}
If I add another interface as super type containing a property with the same name and type, then kotlin-inject throws an error instead of deduplicating the properties:
interface Component1 {
val string: String
}
interface Component2 {
val string: String
}
@Component
abstract class TestComponent : Component1, Component2 {
@Provides
fun provideString(): String = ""
}
Results in:
e: file:///InjectTestComponent.kt:13:16 Conflicting declarations: public open val string: String, public open val string: String
e: file:///InjectTestComponent.kt:16:16 Conflicting declarations: public open val string: String, public open val string: String
kotlin-inject should deduplicate the properties. In a large enough modularized codebase this comes up more often than not.
In a step further, kotlin-inject should inspect super types and use the most concrete type for the property, e.g. following should be supported too:
interface Component1 {
val string: String
}
interface Component2 {
val string: CharSequence
}
@Component
abstract class TestComponent : Component1, Component2 {
@Provides
fun provideString(): String = ""
@Provides
fun provideCharSequence(string: String): CharSequence = string
}
I realized that this is fixed in the latest snapshot builds, likely 16bc1bcb375538c9c9b6c1e9d28456d0a5d8c00c It would be okay for me to close the issue.
Assume following component, which compiles fine
If I add another interface as super type containing a property with the same name and type, then kotlin-inject throws an error instead of deduplicating the properties:
Results in:
kotlin-inject should deduplicate the properties. In a large enough modularized codebase this comes up more often than not.
In a step further, kotlin-inject should inspect super types and use the most concrete type for the property, e.g. following should be supported too: