Why does ```@Component class Foo { inline fun ...
# spring
s
Why does
Copy code
@Component
class Foo {
    inline fun foo() {}
}
gives me
inline' modifier is not allowed on virtual members. Only private or final members can be inlined
s
Perhaps you're using the Kotlin Spring compiler plugin? That will make
@Component
classes and their public members
open
by default, to allow Spring to do its thing. That would explain why
foo
is not being treated as a
final
function.
s
Yea, that seems to be the case. But I was hoping for finding some way to support inline functions in an open class as well, at least when interacting with spring
s
Just mark the function as explicitly
final
Copy code
@Component
class Foo {
    final inline fun foo() {}
}
🙏 1