Reputation: 7321
In the code below I put a breakpoint on the line where it says println("yoyo")
, but it's not getting hit. This is on IntelliJ IDEA 2016.2.5
Build #IC-162.2228.15, built on October 14, 2016. How can I fix this?
class XxxTest {
@Test
fun xxx(){
object : dummyInterface{
override fun bbb() {
println("yoyo")
}
}
}
interface dummyInterface{
fun bbb()
}
}
Upvotes: 0
Views: 1166
Reputation: 4841
Your function xxx
uses Object Expression to create an object of anonymous class inheriting from dummyInterface
. Problem is that you are not using this object anywhere, neither are you storing its reference so it's just created and never called.
For debug to stop at your breakpoint you have to actually call the method.
val obj = object : dummyInterface {
override fun bbb() {
println("yoyo")
}
}
obj.bbb()
Upvotes: 2