1
votes

I have simple getter and setter for a boolean field in Java interface:

public interface Interface1 {
    void setValue1(boolean value);
    boolean getValue1();
}

When trying to implement that as a property in a class in Kotlin:

class Class1: Interface1 {
    var value1 = false
} 

I get the compilation error:

Class 'Class1' is not abstract and does not implement abstract member public abstract fun setValue1(value: Boolean): Unit defined in com.example.Interface1.

So only the getter is overridden. Is it possible to fix that without implementing the both getter and setter manually, without kotlin "sugar"?

1

1 Answers

1
votes

https://youtrack.jetbrains.com/issue/KT-6653 says

This is a rather deep issue, unfortunately. It's unlikely that we'll ever make it work the way you'd like

and this stance doesn't seem to have changed since 2015.