Search code examples
javaeclipseintellij-ideaintellij-14

Indirect access to a static member inspection


Eclipse has had an "Indirect access to static member" inspection available for ages:

enter image description here

Effectively, the following code will produce a warning when compiled with ecj:

class A {
    static void doSmth() {}
}

class B extends A {}

class Main {
    public static void main(String args[]) {
        B.doSmth();
    }
}

How can I enable the same inspection for IDEA? There're dozens of options, but it seems this particular one is merely not there.


Solution

    1. Go to the Intellij Preference
    2. Select Inspections
    3. Select Static method referenced via subclass