java 3rd 方库中的“查找用法”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4263951/
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-10-30 05:35:43  来源:igfitidea点击:

"Find Usages" in 3rd party libraries

javaintellij-idea

提问by ripper234

I'm using Intellij with Maven, so it's very easy to download the source code of any 3rd party library I'm using (assuming it posted the source to the Maven repository, of course). Is it possible to find usages of a method within that 3rd party library?

我将 Intellij 与 Maven 一起使用,因此下载我正在使用的任何 3rd 方库的源代码非常容易(当然,假设它已将源代码发布到 Maven 存储库)。是否可以在该 3rd 方库中找到方法的用法?

In other words, I would like to use IntelliJ's "Find Usages" action and find usages that aren't in my code, but in the 3rd party source code. Is it possible? If not in IntelliJ, is there another tool that does this?

换句话说,我想使用 IntelliJ 的“查找用法”操作并查找不在我的代码中但在第 3 方源代码中的用法。是否可以?如果不在 IntelliJ 中,是否还有其他工具可以执行此操作?

回答by Nico Huysamen

UPDATE

更新

Ok, so I have found out that you can search for usages. When you ALT-F7 (find usages) on a method, simply select your scope as being Project and Librariesinstead of just Project or Module. This works perfectly for me. Finds all usages of methods etc. in other libraries that have source code included.

好的,所以我发现您可以搜索用法。当您在方法上按 ALT-F7(查找用法)时,只需将范围选择为项目和库,而不仅仅是项目或模块。这对我来说非常有效。在包含源代码的其他库中查找方法等的所有用法。

ORIGINAL ANSWERI don't thinkthat is possible (I might be wrong, so if anyone knows I would also be interested in the answer). As I understand it, adding the source code simply gives you the ability to "see" what is going on in that code. It is not reallyincluded in you project. IntelliJ only indexes your own project for finding usages etc.

原始答案认为这是不可能的(我可能是错的,所以如果有人知道我也会对答案感兴趣)。据我了解,添加源代码只是让您能够“查看”该代码中发生的事情。它并未真正包含在您的项目中。IntelliJ 仅索引您自己的项目以查找用法等。

As for other applications, I do not know :)

至于其他应用,我不知道:)

回答by Ed Griffin

IntelliJ's Find Usages feature has scope "Project" and "Project and Libraries" (which includes your maven dependencies). It seems to me the "Project and Libraries" is not available on symbols defined in your source code, but is available on symbols defined in your dependencies.

IntelliJ 的 Find Usages 功能具有范围“项目”和“项目和库”(包括您的 Maven 依赖项)。在我看来,“项目和库”在源代码中定义的符号上不可用,但在依赖项中定义的符号上可用。