Search code examples
javaintellij-idea

IntelliJ IDEA Find Usages


How to find usage of a class or method in IntelliJ IDEA in a library? I could be wrong, but I remember what worked, but now it doesn't. I can find the method definition with Ctrl+LMB, but not the other way around. I am using IntelliJ IDEA 2023.1.2.

I tried invalidating caches and changing the place where to look for, tried removing and adding the library again, but nothing worked. When searching for usages in my project sources everything works fine. I know, that I can decompile library and open it as a project, to be able to search for usages, but it kinda uncomfortable.

Maybe there is a way to enable that or somehow index the library?

Thanks for any help.


Solution

  • Okay, I decompiled the library and added the source jar, now everything works... But this approach will only work if the code is not obfuscated, as in my case. So, in principle, the question remains open.

    Edit: Oh, the decompilers are smart nowadays, especially Fernflower, so they can rename invalid and conflicting identifiers.

    There is a plugin that does it automatically, but it is old and I am not sure it works now: https://plugins.jetbrains.com/plugin/8047-decompile-and-attach