Is this a known bug? ``` open class A { var pu...
# announcements
b
Is this a known bug?
Copy code
open class A {
    var publicGetAndSet: String = ""

    var publicGetPrivateSet: String = ""
        private set
}

class B : A() {
    init {
        this.publicGetAndSet = "Yay"
        this.publicGetPrivateSet = "Yay"
    }
}
crashes with
java.lang.IllegalAccessError: Method 'void com.example.myapp.A.setPublicGetPrivateSet(java.lang.String)' is inaccessible to class 'com.example.myapp.B'
It seems like that shouldn't compile, since the setter is private. While following code does fail to compile
Copy code
open class A {
    var publicGetAndSet: String = ""

    var publicGetPrivateSet: String = ""
        private set
}

class B {
    init {
        val a = A()
        a.publicGetAndSet = "Yay"
        a.publicGetPrivateSet = "Yay" // fails to compile on this line, as expected.
    }
}
So for the same reasoning, I'd expect snippet 1 to fail to compile.