Is there a way to make a write-only property? Just leaving out the getter doesn't work, and having it throwing an exception isn't a compile-time error.
l
little
07/01/2017, 8:18 PM
What if you make a private getter method?
k
karelpeeters
07/02/2017, 9:21 AM
Ah, interesting idea. I'll see if that works, thanks!
package test
public class Test() {
public var str2: String? = null
public set(value) { field = value } //why you used str1?
private get
}
fun main(args: Array<String>) {
Test().str2 = "Test" // INVISIBLE_MEMBER
I am not in a computer to try it myself, but give a try and let me know!