Java – Suppress deprecated import warning in Java

deprecatedimportjavasuppress-warnings

In Java, if you import a deprecated class:

import SomeDeprecatedClass;

You get this warning: The type SomeDeprecatedClass is deprecated

Is there a way to suppress this warning?

Best Answer

To avoid the warning: do not import the class

instead use the fully qualified class name

and use it in as few locations as possible.