gpt4 book ai didi

java - 如何在 Intellij 中的反编译 .class 文件中搜索字符串

转载 作者:搜寻专家 更新时间:2023-10-30 21:07:26 30 4
gpt4 key购买 nike

是否可以使用 Find in Path (Ctrl + Shift + 在反编译的 .class 文件中搜索特定字符串F) 在 Intellij 中?

我想在没有源代码的库代码中搜索。

尽管字符串在编辑器中存在(并且可见),但查找不会弹出任何结果。

最佳答案

如果不事先手动反编译所有类并将反编译源附加到您要搜索的库中,这是不可能的。

IntelliJ IDEA Find in Path works with source and resource files only. It doesn't search in the binary .class files. What you see when you navigate to a .class file is the decompiled version of the class. Decompilation is performed on the fly, IDE doesn't decompile and index all the .class files automatically, therefore there is no index available and no way to perform fast search. Such feature, while technically possible, would require decompiling and indexing all the dependencies which could take a lot of time and system resources, especially in the projects with a lot of dependencies.

Usually there are sources available for the libraries you depend on. For Gradle/Maven projects IntelliJ IDEA can download and configure such sources automatically, so find in path will work inside the libraries with the attached sources for the majority of the users/projects.

In case the library has no sources, you can perform offline decompilation of the entire library using the command line batch decompiler and attach the directory with the decompiled sources to the library.

引自this answer在 IntelliJ IDEA 论坛中。

关于java - 如何在 Intellij 中的反编译 .class 文件中搜索字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45193746/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com