when extending a java class or implementing a java...
# announcements
h
when extending a java class or implementing a java interface that has
getFoo
defined but no
foo
, you cannot add
val foo: Foo = ...
to your kotlin class because of an "accidental override." Is there a way to tell the compiler you intended to override
getFoo
? or am I required to use the syntactically awful
Copy code
private val foo: Foo = ...
override fun getFoo(): Foo = foo
e
Unfortunately, there currently is no other way , I think. See https://youtrack.jetbrains.com/issue/KT-6653