Intellij“评估表达式”导致 NoSuchMethodException

2024-01-24

我正在尝试在调试应用程序时检查 IntelliJ 中中等大的 Scala 对象映射的内容。我在“评估”对话框中输入以下内容:prices.get.keys.toList.filter(k => k.startsWith("GC")), where prices is Future[Map[String, SomeObject]]。我直接在 Iterable 上尝试过,没有toList集合,结果相同。

我得到以下异常: 生成代码调用时出错:com.intellij.debugger.engine.evaluation.EvaluateException: Method threw 'java.lang.NoSuchMethodError' exception.堆栈跟踪的顶部只是我有断点的行。

还有其他人遇到这个吗?如果是这样,有解决方法吗?

堆栈跟踪如下:

c.p.p.e.u.ClassUnderTest$$anonfun$4$GeneratedEvaluatorClass$10$1.invoke(FileToCompile1993.scala:85)
c.p.p.e.u.ClassUnderTest$$anonfun$4.apply(ClassUnderTest.scala:81)
c.p.p.e.u.ClassUnderTest$$anonfun$4.apply(ClassUnderTest.scala:76)
scala.collection.immutable.HashSet$HashSet1.filter0(HashSet.scala:313)
scala.collection.immutable.HashSet$HashTrieSet.filter0(HashSet.scala:929)
scala.collection.immutable.HashSet$HashTrieSet.filter0(HashSet.scala:929)
scala.collection.immutable.HashSet.filter(HashSet.scala:167)
scala.collection.immutable.HashSet.filter(HashSet.scala:35)
c.p.p.e.u.ClassTest.get(ClassTest.scala:76)
c.p.p.e.u.ClassTest.$$anonfun$1.apply$mcV$sp(ClassTest.scala:35)
c.p.p.e.u.ClassTest$$anonfun$1.apply(ClassTest.scala:22)
c.p.p.e.u.ClassTest$$anonfun$1.apply(ClassTest.scala:22)
org.scalatest.Transformer$$anonfun$apply$1.apply$mcV$sp(Transformer.scala:22)
org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
org.scalatest.Transformer.apply(Transformer.scala:22)
org.scalatest.Transformer.apply(Transformer.scala:20)
org.scalatest.FlatSpecLike$$anon$1.apply(FlatSpecLike.scala:1647)
org.scalatest.Suite$class.withFixture(Suite.scala:1122)
org.scalatest.FlatSpec.withFixture(FlatSpec.scala:1683)
org.scalatest.FlatSpecLike$class.invokeWithFixture$1(FlatSpecLike.scala:1644)
org.scalatest.FlatSpecLike$$anonfun$runTest$1.apply(FlatSpecLike.scala:1656)
org.scalatest.FlatSpecLike$$anonfun$runTest$1.apply(FlatSpecLike.scala:1656)
org.scalatest.SuperEngine.runTestImpl(Engine.scala:306)
org.scalatest.FlatSpecLike$class.runTest(FlatSpecLike.scala:1656)
org.scalatest.FlatSpec.runTest(FlatSpec.scala:1683)
org.scalatest.FlatSpecLike$$anonfun$runTests$1.apply(FlatSpecLike.scala:1714)
org.scalatest.FlatSpecLike$$anonfun$runTests$1.apply(FlatSpecLike.scala:1714)
org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:413)
org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:401)
scala.collection.immutable.List.foreach(List.scala:381)
org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:401)
org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:390)
org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:427)
org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:401)
scala.collection.immutable.List.foreach(List.scala:381)
org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:401)
org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:396)
org.scalatest.SuperEngine.runTestsImpl(Engine.scala:483)
org.scalatest.FlatSpecLike$class.runTests(FlatSpecLike.scala:1714)
org.scalatest.FlatSpec.runTests(FlatSpec.scala:1683)
org.scalatest.Suite$class.run(Suite.scala:1424)
org.scalatest.FlatSpec.org$scalatest$FlatSpecLike$$super$run(FlatSpec.scala:1683)
org.scalatest.FlatSpecLike$$anonfun$run$1.apply(FlatSpecLike.scala:1760)
org.scalatest.FlatSpecLike$$anonfun$run$1.apply(FlatSpecLike.scala:1760)
org.scalatest.SuperEngine.runImpl(Engine.scala:545)
org.scalatest.FlatSpecLike$class.run(FlatSpecLike.scala:1760)
org.scalatest.FlatSpec.run(FlatSpec.scala:1683)
org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:55)
org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$3.apply(Runner.scala:2563)
org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$3.apply(Runner.scala:2557)
scala.collection.immutable.List.foreach(List.scala:381)
org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:2557)
org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1044)
org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1043)
org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:2722)
org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1043)
org.scalatest.tools.Runner$.run(Runner.scala:883)
org.scalatest.tools.Runner.run(Runner.scala)
org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:131)
org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67)

我已将 Scala 插件更新到最新版本 2018.2.9,并且正在使用最新版本的 IntelliJ IDEA(来自“关于”对话框):

IntelliJ IDEA 2018.2(终极版) 版本 #IU-182.3684.101,建于 2018 年 7 月 24 日


Scala 调试器在计算复杂表达式(使用 lambda、匿名类、类声明等)时存在一些问题。其中之一https://youtrack.jetbrains.com/issue/SCL-14194 https://youtrack.jetbrains.com/issue/SCL-14194看起来是问题的原因,因为调试器在 lambda 中停止c.p.p.e.u.ClassUnderTest$$anonfun$4.apply(ClassUnderTest.scala:81)并且表达式包含一个 lambda 函数。

原因是 IDEA 在求值之前编译表达式,并且它并不总是正确捕获上下文。作为解决方法,您可以尝试评估其他调试器停止处的表达式,例如常用方法的主体。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Intellij“评估表达式”导致 NoSuchMethodException 的相关文章

随机推荐