Bad type on operand stack running JUnit test


Am not sure where to start with this one and hope it's not a stupid user error on my part.

I have a test that fails at runtime with the error below. If I write a simple class with a main() method and execute the same code, it works. If I move my classes into src/test/java from src/main/java, the test also starts working :S

I tried to create a simpler self-contained example, but was unable to reproduce the issue.

I tried rebuilding the project, etc, but no luck.

Any ideas much appreciated!
Thanks, Alfie.

java.lang.VerifyError: Bad type on operand stack
Exception Details:
  com/akirkpatrick/vnt/RepositoryTests$object.setup()V @54: invokevirtual
  Type ‘jet/Tuple0’ (current frame, stack[0]) is not assignable to ‘com/akirkpatrick/vnt/repository/Repository$object’
  Current Frame:
  bci: @54
  flags: { }
  locals: { ‘com/akirkpatrick/vnt/RepositoryTests$object’, ‘java/io/File’ }
  stack: { ‘jet/Tuple0’, ‘java/lang/String’ }
  0000000: bb00 1659 1218 b700 1c4c 2bb6 0020 9900
  0000010: 122b b600 2399 0007 03a7 0004 04a7 0004
  0000020: 0399 0010 bb00 2559 1227 b700 28c0 002a
  0000030: bfb2 0030 1218 b600 35b1           
  Stackmap Table:


The "java.lang.VerifyError" typically indicate you compiled a source with different/older lib during runtime. Maybe it would be helpful if you show how you compile and how you run your kotlin program will help others to troubleshoot? And what version of kotlin are you using?


Hi Zemian, thanks for your reply. I'm compiling & running in IDEA 12.0.1 with the Kotlin plugin (0.4.297) against the same Kotlin libs version.

I execute the tests in IDEA just by right clicking and selecting Run… unfortunately surefire is not picking up my tests if I compile/run from the command line.



Just for anyone else stumbling across this, I strongly suspect it's related to: I tried to create a simpler reproduction in a new project and hit the error given there.



This is a known issue (, please avoid using class objects in tests until it's fixed (you can use namespace-level functions/properties instead of class object members).


The issue should be fixed by now, could you please check if your test works with the latest Kotlin build? Thanks!