Show deprecated warnings for single class methods

Using eclipse, I want to see a warning as soon as any of my methods used are marked as @Deprecated. A method call is correctly deleted if this is the case, but eclipse does not give a warning if the method comes from the same class. See screenshot below.

Eclipse_warnings

For better playback, I also provided the code in text form:

/* MainClass.java */
public class MainClass {
    public static void main(String[] args) {
        MainClass.foo();
        MemberClass.foo();
        OtherClass.foo();
    }
    @Deprecated
    public static void foo() {
        return;
    }
    private static class MemberClass {
        @Deprecated
        protected static void foo() {
            return;
        }
    }
}

/* OtherClass.java */
public class OtherClass {
    @Deprecated
    public static void foo() {
        return;
    }
}

If only OtherClass.foo()generates a warning. What for? How can i fix this?

  • Enable project specific settings disconnected
  • WindowPreferencesJavaCompilerErrors/WarningsDeprecated and restricted APIif it is fully set to Warning, as can be seen from the figure above.

Note: Does Eclipse not display an obsolete warning? not

+4
1

@Deprecated javadoc, Java, 9.6.4.6.

, , ,

.

MainClass.foo() MemberClass.foo() MainClass, MainClass, .

OtherClass.foo() , .

, , . "", , , - . . , , .

, IDE , , JLS, , . - , .

Eclipse, , , IDE, - .

+3

All Articles