【发布时间】:2022-01-14 16:42:06
【问题描述】:
当我在 if 语句中设置调试点并启用“日志:断点命中消息”时,用于以下 scala 代码
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")
}
}
}
我在控制台中得到以下输出。问题是为什么这个断点会被命中两次?
Breakpoint reached at com.eguller.App1$.iftest(App1.scala:8)
Breakpoint reached at com.eguller.App1$.iftest(App1.scala:8)
但是对于类似的Java代码,断点只被命中一次。
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");
}
我得到以下输出
Breakpoint reached at com.eguller.JApp.main(JApp.java:8)
这是 Intellij 调试器中的错误,还是 Scala 编程语言的一个特性?
IntelliJ IDEA 2021.3 爪哇 - 11 斯卡拉 - 2.12.15
【问题讨论】:
标签: java scala debugging intellij-idea breakpoints