Hallo,
I have a trait Rectangular
import java.awt.Point
public trait Rectangular {
protected val upperLeft : Point
protected val lowerRight : Pointprotected 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?