English 中文(简体)
Eclipse可以突出显示无法访问的代码吗?
原标题:
  • 时间:2009-03-11 22:03:19
  •  标签:

例如,我有一个if子句,它始终为假(不是变量最终)。

public static final boolean FOO = false;
if (FOO) { 
    doSomething(); 
}

我希望它在Eclipse中以灰色的形式呈现,例如。 基本上,我希望它能像Visual C ++为不可达的宏一样完全工作。

Update: I want it to be shown real-time just like Eclipse compiles Java all the time when you make changes to code. This should be possible, shouldn t it? I know there are those dead code tools to do this afterwards but that s not what I like to do.

问题回答

The next version of eclipse (3.5) will have this functionality.

It is currently available from 3.5 milestone 4 onwards as listed in the Eclipse 3.5 M4 - New and Noteworthy

You can get it now by using the latest milestone (3.5M5)

download from the eclipse downloads page

First, you should be aware this is something that is on the verge of being non-computable. Check out the halting problem, if you are unfamiliar with this subject.

Second, there are plug-ins which help in identifying dead code, up to a certain computable limit, such as PMD.





相关问题
热门标签