How are 'navigate to declaration' or 'quick definition' supposed to work when multiple libraries include the same class?

I have two intellij libraries that include a certain class.
One of them has the source attached to it whilst the second one doesn't.
When I attach the one that does have the source, I can use the features like 'go to quick definition' as I would expect.
But if I want to the use the second library, 'quick definition' will point to the one that does not have the source attached to it!

As far as I am concerned, I can attach the source to the second library.

Granted that it will be difficult for Intellij to figure out the user's intention, I expected it to at least navigate to the actual source.
Or if there are multiple options, maybe a popup should be shown to allow the user to choose where to go?

What do you guys think?
Can I create a ticket for this?

1 comment
Comment actions Permalink

Those are different libraries and reusing the same source may be an error. E.g. they can have different versions of the same class.

When you're navigating to the class from module which uses the version with the source attached, the source should be shown. If a module depends on the version without sources, then a decompiled version should be shown. That's how it should work. If it doesn't, then please file a bug.

In your case, I'd suggest either to attach correct sources to both libraries or to merge the libraries into one, if they are really identical.


Please sign in to leave a comment.