Mark
06/05/2025, 7:48 AM@Composable operator fun invoke(): String = …
function. One of the sub interfaces is a fun interface
and I was getting this runtime error whenever invoke()
was called on an instance of that `fun interface`:
java.lang.AbstractMethodError: abstract method "java.lang.String BaseInterface.invoke(androidx.compose.runtime.Composer, int)"
Using a standard interface
instead of a fun interface
solved the problem. AI reckons:
The error occurred because the fun interface was trying to create a synthetic method that conflicted with the @Composable invoke() method from the parent interface. By making it a regular interface, we ensure proper inheritance of all methods from BaseInterface.
Is this a known issue? I can’t post the full data model here because it’s too much code, so I hope this is enough info.dmitriy.novozhilov
06/05/2025, 12:54 PMshikasd
06/05/2025, 3:27 PMMark
06/06/2025, 1:40 PMinterface Foo {
fun foo(): String = "foo"
}
fun interface Bar: Foo {
operator fun invoke(): String
}
fun main() {
val bar = Bar { "bar" }
println("value: ${bar.foo()}") // "does not define or inherit an implementation of the resolved method 'abstract java.lang.String foo()'"
}
shikasd
06/06/2025, 1:41 PMshikasd
06/06/2025, 1:42 PMMark
06/06/2025, 1:49 PM