Avoid suppressing "deprecated" in the replacing class due to Javadoc

Viewed 354

I have an old class which I have made it deprecated with @Deprecated annotation. At the same time, I have made another class that is supposed to replace that deprecated class.

In that new class' Javadoc, I have mentioned that it is meant to replace the deprecated class. This causes the deprecated class to be imported, and gave me the deprecated warning. To remove the warning, I have to use @SuppressWarnings("deprecation") annotation. The result is that my new class looks like it is using something deprecated.

Example:

/**
 * Deprecated class.
 * @deprecated Replaced by @{link ReplacingClass}
 */
@Deprecated 
public class DeprecatedClass {}

The replacing class:

import com.test.example.DeprecatedClass;

/**
 * This class replaces the deprecated class @{link DeprecatedClass}
 */
@SuppressWarnings("deprecation")
public class ReplacingClass {}

What can I do to prevent that?

1 Answers
Related