Eclipse IDE - Open Call Hierarchy 为空/损坏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15542145/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 21:37:46  来源:igfitidea点击:

Eclipse IDE - Open Call Hierarchy is empty/broken

eclipseeclipse-junocall-hierarchy

提问by Skip

What should I do, if the "Open Call Hierarchy" is broken (empty for every method in a project)? It only shows the name of the method I wanted to see the call hierarchy for. This happens for all methods I try, even though they are all called by other methods.

如果“开放调用层次结构”被破坏(项目中的每个方法都为空),我该怎么办?它只显示我想要查看调用层次结构的方法的名称。我尝试的所有方法都会发生这种情况,即使它们都被其他方法调用。

It is very useful for code navigation. I do not know how to work without it!

它对于代码导航非常有用。没有它我不知道如何工作!

I've tried:

我试过了:

  1. Opening eclipse.exe -clean -refresh
  2. Restarting Eclipse
  3. Closing and reopening the project
  4. Updating the project
  5. Renaming the .metadata file
  1. 开幕 eclipse.exe -clean -refresh
  2. 重启 Eclipse
  3. 关闭并重新打开项目
  4. 更新项目
  5. 重命名 .metadata 文件

I've checked that it searches the whole workspace, and there are no filters on.

我检查过它搜索整个工作区,并且没有过滤器。

采纳答案by Skip

The following may help:

以下可能有帮助:

  • Calling eclipse with eclipse.exe -clean -refreshforces Eclipse to rebuild the index. After that the feature worked again.
  • Closing and re-opening the project.
  • 调用 eclipse 会eclipse.exe -clean -refresh强制 Eclipse 重建索引。之后,该功能再次起作用。
  • 关闭并重新打开项目。

回答by Christian Lischnig

I also tried the suggestions above, as well as the hint given here: http://mschrag.blogspot.co.at/2009/01/open-type-cant-find-your-class.html

我也尝试了上面的建议,以及这里给出的提示:http: //mschrag.blogspot.co.at/2009/01/open-type-cant-find-your-class.html

Nothing worked until today when I found out that I am a donkey... I once configured a filter in the "Call Hierarchy" view and so no entries were shown because filtered out. Once I removed / disabled the filter everything worked fine again.

直到今天当我发现我是一头驴子时才起作用……我曾经在“呼叫层次结构”视图中配置了一个过滤器,因此没有显示任何条目,因为过滤掉了。一旦我删除/禁用过滤器一切正常。

回答by Joergi

When you go to the eclipse bug reportfor this issue, somebody says, you should install over the Market place the Java 12 support.
When I installed it, it was working properly again

当您查看有关此问题的Eclipse 错误报告时,有人说,您应该在市场上安装Java 12 support.
当我安装它时,它再次正常工作

回答by Conan

Also, you can try to delete the workspace and get it recreated. Make sure all your projects are backed up.

此外,您可以尝试删除工作区并重新创建它。确保您的所有项目都已备份。

回答by Tuco

For Kepler and PDT (PHP IDE) it is broken in at least PDT 3.2.0 and 3.3.0 (tried them both). The fix is in 3.3.1 and updating to that was all I had to do get the call hierarchy working again.

对于 Kepler 和 PDT(PHP IDE),它至少在 PDT 3.2.0 和 3.3.0(都尝试过)中被破坏。修复是在 3.3.1 中,更新到那个是我必须做的让调用层次结构再次工作。

(apologies, I'm not yet allowed to add comments, however this should prove handy to many)

(抱歉,我还不能添加评论,但这对很多人来说应该很方便)

回答by Leo Ufimtsev

In my case it seemed my workspace was contaminated.

就我而言,我的工作空间似乎被污染了。

Opening/closing projects and starting with clean did not fix. I had to start off a new workspace.

打开/关闭项目并从干净开始没有解决。我不得不开始一个新的工作空间。

Fedora 20, Eclipse Kepler.

Fedora 20,Eclipse 开普勒。

回答by bobbel

I have the same behavior with eclipse Kepler (4.3.2).

我与 eclipse Kepler (4.3.2) 有相同的行为。

I found out, that there is a bug with methods with signature of:

我发现,带有签名的方法存在一个错误:

void get(Object o)
Object get(Object o)

In the eclipse Error Logview I find the following exception:

在 eclipse错误日志视图中,我发现以下异常:

java.lang.NullPointerException
    at org.eclipse.jdt.internal.core.search.matching.ClasspathSourceDirectory.directoryTable(ClasspathSourceDirectory.java:52)
    at org.eclipse.jdt.internal.core.search.matching.ClasspathSourceDirectory.findClass(ClasspathSourceDirectory.java:109)
    at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.findClass(JavaSearchNameEnvironment.java:146)
    at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.findType(JavaSearchNameEnvironment.java:185)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:145)
    at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:197)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2799)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:2556)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.getType(MatchLocator.java:899)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.getMethodBinding0(MatchLocator.java:955)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.getMethodBinding(MatchLocator.java:907)
    at org.eclipse.jdt.internal.core.search.matching.MethodLocator.matchMethod(MethodLocator.java:327)
    at org.eclipse.jdt.internal.core.search.matching.MethodLocator.resolveLevel(MethodLocator.java:664)
    at org.eclipse.jdt.internal.core.search.matching.ClassFileMatchLocator.locateMatches(ClassFileMatchLocator.java:209)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:1699)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1143)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1184)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1301)
    at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:95)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:231)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:515)
    at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:584)
    at org.eclipse.jdt.internal.corext.callhierarchy.CallerMethodWrapper.findChildren(CallerMethodWrapper.java:155)
    at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.performSearch(MethodWrapper.java:301)
    at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.doFindChildren(MethodWrapper.java:232)
    at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.getCalls(MethodWrapper.java:84)
    at org.eclipse.jdt.internal.ui.callhierarchy.DeferredMethodWrapper.getCalls(DeferredMethodWrapper.java:65)
    at org.eclipse.jdt.internal.ui.callhierarchy.DeferredMethodWrapper.fetchDeferredChildren(DeferredMethodWrapper.java:79)
    at org.eclipse.ui.progress.DeferredTreeContentManager.run(DeferredTreeContentManager.java:235)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

In the end, it looks like a bug in this version:

最后,它看起来像这个版本中的一个错误:

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

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

I assume, that upgrading at least to version 4.4 (Luna) will solve this problem.

我认为,至少升级到版本 4.4 (Luna) 将解决这个问题。

回答by Thomas Lauria

In my case I was trying to get the call hierarchy of a method in the derived class of an abstract class. The requested method was declared abstract in the base class. When I opened the call hierarchy directly on the abstract method instead of the implemented one, everything worked well. (Eclipse Neon).

就我而言,我试图在抽象类的派生类中获取方法的调用层次结构。请求的方法在基类中被声明为抽象的。当我直接在抽象方法而不是实现的方法上打开调用层次结构时,一切都运行良好。(日蚀霓虹灯)。

回答by jedison

My problem was that Open Call Hierarchy was searching only the project not the entire Workspace. So I had to click on the small down arrow (in the Call Hierarchy view window on the right; it is the "View Menu" arrow -- a triangle pointing down) in Call Hierarchy view, set the Search Scope > Workspace.

我的问题是 Open Call Hierarchy 只搜索项目而不是整个工作区。因此,我必须单击“调用层次结构”视图中的小向下箭头(在右侧的“调用层次结构”视图窗口中;它是“查看菜单”箭头——一个向下的三角形),设置搜索范围 > 工作区。

回答by VINAY VKK

Tried everything in all the answers here, but none of them worked for me. Later I figured out that this was a bug in Eclipse 2019-03 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=545293). Try to upgrade your eclipse or install a newer version. For me installing a newer version(latest version Eclipse 2019-09) solved the problem.

在这里尝试了所有答案中的所有内容,但没有一个对我有用。后来我发现这是 Eclipse 2019-03 ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=545293) 中的一个错误。尝试升级您的 eclipse 或安装更新的版本。对我来说,安装较新版本(最新版本 Eclipse 2019-09)解决了这个问题。