QuiltMC/enigma

[bug] navigation from calls tree does not work if the target call is in an anonymous class

Decencies opened this issue · 6 comments

When attempting to navigate to the call declaration of a method, if the declaration is in an inner class, will do nothing.

For example:

Call declarations within ClassName$<id> won't be navigated to, whereas those declared in non inner classes will navigate just fine.

java_a7RtG71J9a

Tested version: 1.7.3

I have hunted this down and the issue is actually not inner classes, but anonymous classes. Any class where the representation looks like ClassName$[number] (ClassName$1, ClassName$8, etc) will break navigation from the calls tree. That makes this:
a. much less severe
and b. more difficult to fix as well, anonymous classes are a little odd in many ways but I'll look into a fix!

(example: the top navigation here is broken, but the bottom one works)
image

this can be reproduced via :completeTestGui, viewing calls on a() in class q (obfuscated names).

I was able to trace the issue to this line, which makes anonymous and local classes explicitly not navigable. I do not know why this was done, but simply removing that if block appears to fix the issue.

can confirm that that fixes the issue, thanks!
@ByMartrixx why does this commit introduce that if block?

Anonymous classes don't have a declaration entry to navigate to. Local classes do, but we don't have a way to tell them apart (yet). Navigation to entries of these classes doesn't work because line 376 of GuiController checks that the location class entry of a reference is navigable, while it should probably check just the entry or its parent instead

Anonymous classes don't have a declaration entry to navigate to.

That makes sense. That means the fix I suggested would break if the user managed to make Enigma try to navigate to an anonymous class.

it should probably check just the entry or its parent instead

Checking the entry itself is probably the best solution IMO. Checking the parent would result in this same bug for methods inside anonymous classes.