Question about trait problem

Hallo,

I have a trait Rectangular

import java.awt.Point

public trait Rectangular {

  protected val upperLeft : Point
  protected val lowerRight : Point

  protected fun printBounds() {
  println(upperLeft)
  println(lowerRight)
  }

}


and a class Rectangle that makes use of the Rectangular trait:

open class Rectangle(upperLeftParam: Point, lowerRightParam: Point) : Rectangular {   override var upperLeft = upperLeftParam   override var lowerRight = lowerRightParam

  fun foo() {
  printBounds()
  }
}

fun main(args: Array<String>) {
  var rect = Rectangle(Point(0, 5), Point(5, 0))
  rect.foo()
}


This compiles fine, but throws an exception when executed:

Exception in thread "main" java.lang.IllegalAccessError: Rectangle.getUpperLeft()Ljava/awt/Point;   at Rectangular$$TImpl.printBounds(Rectangular.kt:16)   at Rectangle.printBounds(Rectangle.kt)   at Rectangle.foo(Rectangle.kt:16)   at namespace$src$Rectangle$620803626.main(Rectangle.kt:22)   at namespace.main(Rectangular.kt)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)   at java.lang.reflect.Method.invoke(Method.java:601)   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Am using IDEA IC-122.519 and Kotlin plugin   0.4.68. Funny thing is that it even won't go into the debugger. Am I doing something wrong here or is there a problem?

This is a bug, please report it to our tracker. Thanks!

Okay, here we go: http://youtrack.jetbrains.com/issue/KT-3029

Please for this one. Traits are really cool. You need to have them, the sooner the more fun ... ;-)

Let's be fair: the only thing you can't do right now is have protected members in your traits. You can have almost as much fun having those members public. :)

I should have been more precise, I guess. Sorry about that. Looking forward to M4. This will be the real thing milestone release for me :-).