Compiler exception on Long

  val MAX_FPS : Long = 25  //desired FPS   val MAX_FRAME_SKIPS = 5   val FRAME_PERIOD : Long = 1000.toLong() / MAX_FPS

  public override fun run(){
  Log.d(TAG, “Starting game loop”)
  var beginTime : Long
  var sleepTime : Long
  var delta : Long
  var frameSkipped : Int

    while(running){

           beginTime = System.currentTimeMillis()
           frameSkipped = 0

           world.process()

           delta = System.currentTimeMillis() - beginTime
           world.setDelta(delta.toFloat())

           sleepTime = (FRAME_PERIOD - delta).toLong()
           if (sleepTime > 0){
           synchronized(this){
                   try{
                   this.wait(sleepTime)
                   }
                   catch (e : InterruptedException)
                   {
                   }
           }
           }

           while(sleepTime < 0 && frameSkipped < MAX_FRAME_SKIPS){
           //catch up without rendering
           world.process()
           sleepTime += FRAME_PERIOD
           frameSkipped++
           }
  }
  }

Error:[Criminals] EXCEPTION FROM SIMULATION: Error:[Criminals] stack mismatch: illegal top-of-stack for opcode Error:[Criminals] ...at bytecode offset 00000042 Error:[Criminals] locals[0000]: Lcom/silverkeytech/criminals/GameLoopThread; Error:[Criminals] locals[0001]: J Error:[Criminals] locals[0002]: <invalid> Error:[Criminals] locals[0003]: Ljet/runtime/SharedVar$Long; Error:[Criminals] locals[0004]: J Error:[Criminals] locals[0005]: <invalid> Error:[Criminals] locals[0006]: I Error:[Criminals] stack[0002]: <invalid> Error:[Criminals] stack[0001]: J Error:[Criminals] stack[top0]: Ljet/runtime/SharedVar$Long; Error:[Criminals] ...while working on block 003e Error:[Criminals] ...while working on method run:()V Error:[Criminals] ...while processing run ()V Error:[Criminals] ...while processing C:/Repository/Criminals/out/production/Criminals/com/silverkeytech/criminals/GameLoopThread.class Error:[Criminals] 1 error; aborting

Looks like a bug. Please report it to our bug tracker. Thanks.

http://youtrack.jetbrains.com/issue/KT-3042. I put a sample runnable code as well.