I would like to make one of my methods "deprecated" = not used anymore.
But still I would like to have it in my API. I just want to show "warning" to anyone using that method.
How can I achieve that?
I would like to make one of my methods "deprecated" = not used anymore.
But still I would like to have it in my API. I just want to show "warning" to anyone using that method.
How can I achieve that?
Use both
@Deprecated
annotation and the@deprecated
JavaDoc tag.The
@deprecated
JavaDoc tag is used for documentation purposes.The
@Deprecated
annotation instructs the compiler that the method is deprecated. Here is what it says in Sun/Oracles document on the subject:You can find the full document at How and When to Deprecate APIs
Use the annotation
@Deprecated
for your method, and you should also mention it in your javadocs.Use
@Deprecated
on method. Don't forget about clarifying javadoc field:Take a look at the
@Deprecated
annotation.There are two things you can do:
@Deprecated
annotation to the method, and@deprecated
tag to the javadoc of the methodYou should do both!
Quoting the java documentation on this subject:
since some minor explanations were missing
Use
@Deprecated
annotation on the method like thisremember to explain:
<br/>
{@link #setPurchasePrice()}