vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Static interface methods not recognized on type generics

Open msohaill opened this issue 7 months ago • 1 comments

Following is some sample code to replicate the issue:

public class Tester<T extends Thing> {
    public void test() {
        System.out.println("Testing: " + T.getStuff());  // Error is here
    }

    public static void main(String[] args) {
        Tester<OtherThing> tester = new Tester<>();
        tester.test();
    }

}

interface Thing {
    static String getStuff() {
        return "Stuff";
    }
}

class OtherThing implements Thing {
}

With this, I get a build error: The method getStuff() is undefined for the type T Java(67108964). However, enabling the "java.jdt.ls.javac.enabled" works, but is not an ideal solution.

This occurs with the latest Language Support for Java(TM) by Red Hat - v1.42.0.

msohaill avatar May 25 '25 17:05 msohaill

upstream issue https://github.com/eclipse-jdt/eclipse.jdt.core/issues/4550

fbricon avatar Oct 24 '25 13:10 fbricon