Skip to content
Advertisement

Suppress deprecated import warning in Java

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?

Advertisement

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.

Advertisement