import java.util.*
class MySet : TreeSet<Int>() {
override fun remove(element: Int): Boolean {
if (!super.remove(element)) return false
return true
}
}
fun main(args: Array<String>) {
MySet()
}
I compile the code above, it compiles well, but when I run it, I get the following mistake:
Exception in thread "main" java.lang.VerifyError: Bad local variable type
Exception Details:
Location:
MySet.remove(Ljava/lang/Integer;)Z @1: iload_1
Reason:
Type 'java/lang/Integer' (current frame, locals[1]) is not assignable to integer
Current Frame:
bci: @1
flags: { }
locals: { 'MySet', 'java/lang/Integer' }
stack: { 'MySet' }
Bytecode:
0x0000000: 2a1b b800 11b7 0013 9a00 0503 ac04 ac
Stackmap Table:
same_frame(@13)
at AaKt.main(Aa.kt:11)
Compiler version:
$ kotlinc -version
info: kotlinc-jvm 1.1.4 (JRE 1.8.0_101-b13)