1

I'm using IntelliJ 15 and I'm trying to find usages of methods and objects in a .java file packed in a .jar file downloaded through Maven. I now that they're used: I can find them through the simple search (ctrl+f) command, but when I try with the Find Usages command the post-title message is returned.

I've read this post, but it doesn't work.

This an example of a method in a file InstanceManager.class (belonging to .jar file imported with Maven):

private void notifyNewInstance(Instance instance) {
    List var2 = this.instanceListeners;
    synchronized(this.instanceListeners) {
        Iterator var3 = this.instanceListeners.iterator();

        while(var3.hasNext()) {
            InstanceListener listener = (InstanceListener)var3.next();

            try {
                listener.newInstanceAvailable(instance);
            } catch (Throwable var7) {
                LOG.error("Notification of new instance availability failed.", var7);
            }
        }

    }
}

And in the same file is called with this.notifyNewInstance(host); but if I use Find usages on notifyNewInstance I'll receive the error.

UPDATE: I've tried to Download the source code, but I get the message:

Cannot download sources Sources not found for: org.apache.flink:flink-runtime_2.10:1.1-20160316.114232-35

Can you help me with that?

7
  • 1
    What type of usage is there? Could it be that there are multiple classes with the same name on your classpath (but with different package names)? Have you tried ticking all the boxes when doing advanced usage search (ctrl+shift+alt+F7)?
    – Tobb
    Mar 18, 2016 at 10:28
  • I don't understand what you mean by "type of usage", but for example in find of usage of a method, I would like to see a list of where the method is called, and this doesn't happen (even if I KNOW that it does even in the same file). Mar 18, 2016 at 10:30
  • 1
    Is the .jar you downloaded a dependency? If so, it's not a usage in your Project Files because it's read as a dependency by IntelliJ. Can you also provide code and/or examples of what you're doing as it is unclear.
    – Harmelodic
    Mar 18, 2016 at 11:23
  • Updated with example Mar 18, 2016 at 13:01
  • That method is decompiled from a class file... It isn't part of the class file. You have to download the sources of the Maven library if you want to search the methods Mar 18, 2016 at 13:05

1 Answer 1

0

You need to get the source code.

Assuming you're attempting to do this on Apache Flink:

Source Code found here

If you only want a particular folder from the source code, you can use the method found here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.