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?

Answer

Use this annotation on your class or method:

@SuppressWarnings( "deprecation" )


Source: stackoverflow