IllegalAccessError (when accessing protected trait var)


#1

Hi,

This happens only if ‘prop’ is protected.

trait Trait{
  protected var prop : String
  fun accessProp(){
  var v = prop
  }
}

class Class : Trait{
  protected override var prop: String = “”
}

Test fun test() {
  var c = Class()
  c.accessProp()
}

“java.lang.IllegalAccessError: tests.Class.getProp()Ljava/lang/String;”


#2

Please report bugs directly to issue tracker. Thank you!


#3

I was just about to, but it seems it's already reported


#4

Seems so. In this case, you can vote for it :)