[java] Non static methods should not be provided as a completion on class object
ghostbuster91 opened this issue · comments
Describe the bug
given following java file:
package com.example;
import java.util.List;
public class Service {
public static String hello(){
return "hello";
}
public String nonStaticHello(){
return "nonStatic";
}
public static void main(String[] args) {
System.out.println(Service.$$$$);
}
}
If we try to invoke completions on Service
class where the $$$$
denotes cursor position we will get in return:
nonStaticHello()~ Method
hello()~ Method
wait()~ Method
clone()~ Method
notify()~ Method
getClass()~ Method
hashCode()~ Method
toString()~ Method
finalize()~ Method
notifyAll()~ Method
wait(long arg0)~ Method
wait(long arg0, int arg1)~ Method
main(java.lang.String[] args)~ Method
equals(java.lang.Object arg0)~ Method
This is incorrect. The nonStaticHello
method is a regular non static method and cannot be invoked on the Service
class object.
Expected behavior
Non static methods should not be reported in completions on the class object.
Operating system
Linux
Editor/Extension
Nvim (nvim-metals)
Version of Metals
1.3.0
Extra context or search terms
java, completions, static