本文介绍了为什么我不断得到“评估必须包含一个表达式或一个格式正确的语句”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的代码中,我想在表达式窗口中输出 src 的值。

  public void doIt(){
String src =test;
System.out.println(src);
}

在Eclipse中。我在第3行设置一个断点,我打开表达式窗口。



我添加一个表达式 src 评估,我得到



我使用表达式功能...在我多年的Java调试中有COUNTLESS次..为什么现在这样发生?



我刚刚开始使用Eclipse Juno .. vs靛蓝。他们是否改变了表达式的工作方式?

解决方案

如果您的代码使用任何泛型,您可能需要检查此错误: p>



发生在所有版本的Eclipse中,最高为4.2。简单来说,某些泛型表达式会导致Eclipse在任何评估中完全失败(请参阅此示例:)。不知道你的代码是否使用任何泛型,但如果是这样,这可能就是这样。请注意,您的课程中有一个麻烦的泛型是足够的,在您的方法中不需要。


In my code, I am trying to output the value of src in the expressions window.

public void doIt() {
    String src = "test";
    System.out.println(src);
}

In Eclipse. I set a breakpoint on a line 3, and I open the "Expressions" window.

I add an expression src to evaluate, and I get

I used the Expressions features... COUNTLESS times in my years of Java debugging.. Why does this happen now?

I just recently started using Eclipse Juno.. vs Indigo. Did they change the way Expressions work?

解决方案

If your code use any generics, you may want to check this bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=341232

Occurs in all version of Eclipse up to 4.2. In short certain generics expressions cause Eclipse to completely fail on any evaluation (please see this example: https://bugs.eclipse.org/bugs/attachment.cgi?id=224760). Not sure whether your code uses any generics, but if so, this may be it. Note that it is enough to have one of the troublesome generics somewhere in your class, not necessary in your method.

这篇关于为什么我不断得到“评估必须包含一个表达式或一个格式正确的语句”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 23:47