For following scala code when I set a debug point at if statement and enable "Log: Breakpoint hit message"
object App1 {
def main(args: Array[String]): Unit = {
iftest()
}
def iftest(): Unit = {
val setA: Set[String] = Set("a", "b", "c");
var setB: Set[String] = Set("d", "e", "f")
if(setA.size > setB.size){ //here break point at line 8
println("bigger")
}
}
}
I got the following output in console. The question is why this breakpoint is hit twice?
Breakpoint reached at com.eguller.App1$.iftest(App1.scala:8)
Breakpoint reached at com.eguller.App1$.iftest(App1.scala:8)
But for following similar Java code, the breakpoint is hit only once.
Set<String> set1 = new HashSet<>();
set1.add("1");
set1.add("2");
Set<String> set2 = new HashSet<>();
set2.add("a");
set2.add("b");
if(set1.size() > set2.size()){ //here break point at line 8
System.out.println("size different");
}
I got the following output
Breakpoint reached at com.eguller.JApp.main(JApp.java:8)
Is it a bug in Intellij debugger, or is it a feature of Scala programming language?
IntelliJ IDEA 2021.3 Java - 11 Scala - 2.12.15