Hello, I’m dealing with following issue with Kotli...
# announcements
j
Hello, I’m dealing with following issue with Kotlin/Java Compiler. Imagine following scenario: let
First
be a Java class with a final function and
Second
be a Kotlin class extending
First
with a function of the same name like the final function in
First
class, i. e.:
Copy code
// Java class
class Firs {
    final void foo() { }
}
Copy code
// Kotlin class
class Second: First() {
    fun foo() { }
}
Obviously, it’s wrong because the final function
foo()
can not be overridden. However, compilation pass successfully and in run-time I get
java.lang.LinkageError: Method void Second.foo() overrides final method in class First
. Is this correct behavior of compiler? I supposed that there will be some validations for this case. Thank you! 🙂
😬 2
👌 1