M7 Error


#1

When I upgraded my codebase to M7, I'm now getting the following error when launching the app:

java.lang.VerifyError: Instruction type does not match stack map

Exception Details:

  Location:

  com/steamstreet/unstoppable/admin/AdminPackage$initRoutes$4.invoke(Lcom/steamstreet/unstoppable/api/RouteHandler;)V @694: aload

  Reason:

  Current frame's stack size doesn't match stackmap.

  Current Frame:

  bci: @694

  flags: { }

  locals: { 'com/steamstreet/unstoppable/admin/AdminPackage$initRoutes$4', 'com/steamstreet/unstoppable/api/RouteHandler', 'com/steamstreet/logging/LoggingClient', 'com/steamstreet/unstoppable/economy/EconomyManager', 'kotlin/jvm/internal/Ref$ObjectRef', 'java/lang/String', 'com/steamstreet/logging/LoggingQuery', 'java/util/List', top, 'java/lang/Iterable', 'java/lang/Iterable', 'java/util/Collection', 'java/util/Iterator', 'java/lang/Object', 'java/util/Map', 'java/util/HashMap', 'java/lang/Exception' }

  stack: { }

  Stackmap Frame:

  bci: @694

  flags: { }

  locals: { 'com/steamstreet/unstoppable/admin/AdminPackage$initRoutes$4', 'com/steamstreet/unstoppable/api/RouteHandler', 'com/steamstreet/logging/LoggingClient', 'com/steamstreet/unstoppable/economy/EconomyManager', 'kotlin/jvm/internal/Ref$ObjectRef', 'java/lang/String', 'com/steamstreet/logging/LoggingQuery', 'java/util/List', top, 'java/lang/Iterable', 'java/lang/Iterable', 'java/util/Collection', 'java/util/Iterator', 'java/lang/Object', 'java/util/Map', 'java/util/HashMap', 'java/lang/Object' }

  stack: { 'java/util/Collection' }

This is fairly serious, and is preventing me from updating to the latest version.

#2

More information... the problem seems to be happening because of some exception handling code within a map() literal:

somecollection.map {   try {   doSomething();   } catch (Exception: e) {   } }

When I remove the try/catch, the code runs fine.


#3

Thanks for the report. Could you file it as an issue in the tracker?


#4

To work around this problem, try to switch off inlining, as described here: http://blog.jetbrains.com/kotlin/2014/03/m7-release-available/#more-1439


#5

I see how to turn it off in IDEA, and it works fine. I don't see how to access this via Gradle. How to I configure Kotlin compiler flags in Gradle?

Update: Found it:

compileKotlin {
  kotlinOptions.inline = false
}

#6

Youtrack issue: http://youtrack.jetbrains.com/issue/KT-4788