Suppress deprecated import warning in Java

Ed Mazur picture Ed Mazur · Dec 7, 2009 · Viewed 67.5k times · Source

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?

Answer

Kasper van den Berg picture Kasper van den Berg · Jan 3, 2014

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.