Uninitialized object on stack?


I am a newbie to Kotlin and I have an error I hope someone can resolve for me.

To find my way around Kotlin I have started a project to develop a builder for JavaFX.
Part of that involves developing an MVC framework. The basic architecture is built around the following
abstract classes that establish the framework:

abstract class MVCAB(val name: String, val par: MVCAB? = null) {

  abstract class ModelAB {


  }   // ModelAB

  abstract class ViewAB(val model: ModelAB) {


  }   // ViewAB

  abstract class ControllerAB(val model: ModelAB, val view: ViewAB) {


  }   // ControllerAB

// ---------- properties ----------------------------------

  public abstract val model: ModelAB
  public abstract val view: ViewAB
  public abstract val controller: ControllerAB


A concrete example is then defined in an application:

class ExampleMVC : MVCAB("ExampleMVC", null) {

  public class ExampleModel : MVCAB.ModelAB() {


  class ExampleView(model: MVCAB.ModelAB) : MVCAB.ViewAB(model) {

    // ---------- properties ------------------------------

    val stage = builder?.stage(arrayList("title" to "DemoFX", "x" to 100, "y" to 100, "width" to 400, "height" to 300)) {

           scene(arrayList(“someting” to “something”)) {
           flowPane(arrayList(“hgap” to 5)) {
                   text(arrayList(“text” to “Application widgets go here”))

  class ExampleController(model: MVCAB.ModelAB, view: MVCAB.ViewAB) : MVCAB.ControllerAB(model, view) {


  override public val model: MVCAB.ModelAB = ExampleModel()          // LINE 40
  override public val view: MVCAB.ViewAB = ExampleView(model)
  override public val controller: MVCAB.ControllerAB = ExampleController(model, view)


And run with:

class ExampleFX : Application() {

  fun startup(args: Array<String>) {

  override fun start(p0: Stage?): Unit {
  val mvc: ExampleMVC = ExampleMVC()




fun main(args: Array<String>) {
  println(“Hello ExampleFX”)

  val ex = ExampleFX()          // LINE 25

  println(“Bye ExampleFX”)

I get the following execution error:

Hello ExampleFX Exception in Application start method Exception in thread "main" java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:378) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:27) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:97) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.VerifyError: (class: example/ExampleMVC$ExampleModel, method: <init> signature: (Lexample/ExampleMVC;)V) Expecting to find unitialized object on stack at example.ExampleMVC.<init>(ExampleMVC.kt:40) at example.ExampleFX.start(ExampleFX.kt:25) at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:298) at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:152) at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:119) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29) at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62) ... 1 more

Process finished with exit code 1

Any suggestions? Have I made an error in the code? Is there a bug?



This is a bug. Please, report to our tracker.