I encountred a problem when building a Swing application in Kotlin. I reduced it to a minimal test case which causes a compiler exception using M5.
import java.awt.event.*
class Foo() : WindowAdapter() {
fun windowClosing(e : WindowEvent) {}
}
Additional information which may be helpful:
If “override” is added to the windowClosing function, it compiles and runs correctly.
The other 9 methods in WindowAdapter work without override. If override is added to any of them, there is a compiler error message about overridng “nothing”. I believe all the methods in WindowAdapter are concrete but empty.
Dody, You are correct, changing to WindowEvent? produces a clean compile for the windowClosing function.
However, using WindowEvent? causes a compiler exception for the other methods. So now
class Foo() : WindowAdapter() {
fun windowOpened(e : WindowEvent?){}
}
causes an exception, while with WindowEvent it works.
Clearly, something is broken and probably manifesting itself in multiple ways. Probably no need for further test cases. With a simple, repeatable test case, the bug should be easy to find.
Anyway, I have a workaround and am able to continue with my learning curve coding.