kotlin - Modifier 'override' is not applicable to 'getter' -


i have in code

var barcode: barcode? = null 

now getbarcode() defined in interface - error might accidental override. unfortunately not work:

var barcode: barcode? = null override 

i this:

private var barcode: barcode? = null  override fun getbarcode(): barcode? = barcode fun setbarcode(barcode: barcode) {     this.barcode = barcode } 

but looks way many likes , verbosity kotlin - there must shorter way - pattern repeat multiple times in class

as of kotlin 1.0, there no shorter way: method getbarcode() in java interface needs implemented method named getbarcode() in kotlin, not property named barcode.

there's an issue requesting make possible override java methods properties; can vote notifications of updates.


Comments