Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support invocation expressions in LSP Call Hierarchy; bugfixes #3955

Merged
merged 3 commits into from
Apr 11, 2022

Conversation

sdedic
Copy link
Member

@sdedic sdedic commented Apr 11, 2022

Call hierarchy implementation for LSP throws an exception:

java.lang.NullPointerException
	at org.netbeans.modules.refactoring.java.callhierarchy.CallHierarchyTasks$CallersTask.runTask(CallHierarchyTasks.java:313)
[catch] at org.netbeans.modules.refactoring.java.callhierarchy.CallHierarchyTasks$CallTaskBase.run(CallHierarchyTasks.java:288)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

on a trivial source:

package org.yourcompany.yourproject;

public class Locations {

    private void m1() {
        m2();
    }

    private void m2() {
        m3();
    }

    private void m3() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}

when the caret is positioned at stuff outside of method scope. It does not show any results on method invocations.


My bad, the implementation was oversimplified as the code only searched for the enclosing method. This PR extends that to method invocation and new expressions. Some other bugs were also fixed.

@sdedic sdedic added kind:bug Bug report or fix LSP [ci] enable Language Server Protocol tests VSCode Extension [ci] enable VSCode Extension tests labels Apr 11, 2022
@sdedic sdedic added this to the NB14 milestone Apr 11, 2022
@sdedic sdedic requested review from ppisl and dbalek April 11, 2022 07:46
@sdedic sdedic self-assigned this Apr 11, 2022
Copy link
Member

@ppisl ppisl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this. Looks good to me.

@sdedic sdedic merged commit 144e91c into apache:master Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Bug report or fix LSP [ci] enable Language Server Protocol tests VSCode Extension [ci] enable VSCode Extension tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants