# Bad type on operand stack running JUnit test

**URL:** <https://discuss.kotlinlang.org/t/bad-type-on-operand-stack-running-junit-test/952>\
**Category:** Uncategorized\
**Created:** [December 29, 2012, 4:54pm UTC](https://discuss.kotlinlang.org/t/bad-type-on-operand-stack-running-junit-test/952 "2012-12-29T16:54:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jugglingcats](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jugglingcats](https://discuss.kotlinlang.org/u/jugglingcats)\
**Post date:** [December 29, 2012, 4:54pm UTC](https://discuss.kotlinlang.org/t/bad-type-on-operand-stack-running-junit-test/952/1 "2012-12-29T16:54:53Z")

</div>

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:  
&nbsp;&nbsp;Location:  
 &nbsp;&nbsp;com/akirkpatrick/vnt/RepositoryTests$object.setup()V @54: invokevirtual  
&nbsp;&nbsp;Reason:  
 &nbsp;&nbsp;Type ‘jet/Tuple0’ (current frame, stack[0]) is not assignable to ‘com/akirkpatrick/vnt/repository/Repository$object’  
&nbsp;&nbsp;Current Frame:  
 &nbsp;&nbsp;bci: @54  
 &nbsp;&nbsp;flags: { }  
 &nbsp;&nbsp;locals: { ‘com/akirkpatrick/vnt/RepositoryTests$object’, ‘java/io/File’ }  
 &nbsp;&nbsp;stack: { ‘jet/Tuple0’, ‘java/lang/String’ }  
&nbsp;&nbsp;Bytecode:  
 &nbsp;&nbsp;0000000: bb00 1659 1218 b700 1c4c 2bb6 0020 9900  
 &nbsp;&nbsp;0000010: 122b b600 2399 0007 03a7 0004 04a7 0004  
 &nbsp;&nbsp;0000020: 0399 0010 bb00 2559 1227 b700 28c0 002a  
 &nbsp;&nbsp;0000030: bfb2 0030 1218 b600 35b1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  
&nbsp;&nbsp;Stackmap Table:  
 &nbsp;&nbsp;append\_frame(@28,Object[#22])  
 &nbsp;&nbsp;same\_locals\_1\_stack\_item\_frame(@29,Integer)  
 &nbsp;&nbsp;same\_frame(@32)  
 &nbsp;&nbsp;same\_locals\_1\_stack\_item\_frame(@33,Integer)  
 &nbsp;&nbsp;same\_frame(@49)

---

<div class="post-metadata">

**Author:** ![saltnlight5](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/saltnlight5/32/1525_2.png) [@saltnlight5](https://discuss.kotlinlang.org/u/saltnlight5)\
**Post date:** [December 29, 2012, 5:08pm UTC](https://discuss.kotlinlang.org/t/bad-type-on-operand-stack-running-junit-test/952/2 "2012-12-29T17:08:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jugglingcats](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jugglingcats](https://discuss.kotlinlang.org/u/jugglingcats)\
**Post date:** [December 29, 2012, 8:48pm UTC](https://discuss.kotlinlang.org/t/bad-type-on-operand-stack-running-junit-test/952/3 "2012-12-29T20:48:31Z")

</div>

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.

Alfie.

---

<div class="post-metadata">

**Author:** ![jugglingcats](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jugglingcats](https://discuss.kotlinlang.org/u/jugglingcats)\
**Post date:** [January 3, 2013, 8:58pm UTC](https://discuss.kotlinlang.org/t/bad-type-on-operand-stack-running-junit-test/952/4 "2013-01-03T20:58:18Z")

</div>

Just for anyone else stumbling across this, I strongly suspect it's related to: [http://youtrack.jetbrains.com/issue/KT-2990](http://youtrack.jetbrains.com/issue/KT-2990). I tried to create a simpler reproduction in a new project and hit the error given there.

Alfie.

---

<div class="post-metadata">

**Author:** ![udalov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/udalov/32/5679_2.png) [@udalov](https://discuss.kotlinlang.org/u/udalov)\
**Post date:** [January 9, 2013, 11:29am UTC](https://discuss.kotlinlang.org/t/bad-type-on-operand-stack-running-junit-test/952/5 "2013-01-09T11:29:52Z")

</div>

This is a known issue ([http://youtrack.jetbrains.com/issue/KT-2717](http://youtrack.jetbrains.com/issue/KT-2717)), please avoid using class objects in tests until it's fixed (you can use namespace-level functions/properties instead of class object members).

---

<div class="post-metadata">

**Author:** ![udalov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/udalov/32/5679_2.png) [@udalov](https://discuss.kotlinlang.org/u/udalov)\
**Post date:** [January 9, 2013, 2:40pm UTC](https://discuss.kotlinlang.org/t/bad-type-on-operand-stack-running-junit-test/952/6 "2013-01-09T14:40:36Z")

</div>

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