Java
  • Introduction
  • First Chapter
  • Utility Class
  • equalsbuilder&hashcodebuilder
  • @Deprecated
  • backward compatibility
  • EHCACHE
Powered by GitBook
On this page

Was this helpful?

@Deprecated

Previousequalsbuilder&hashcodebuilderNextbackward compatibility

Last updated 6 years ago

Was this helpful?

@Deprecated

When to Deprecate

When you design an API, carefully consider whether it supersedes an old API. If it does, and you wish to encourage developers (users of the API) to migrate to the new API, then deprecate the old API. Valid reasons to deprecate an API include:

  • It is insecure, buggy, or highly inefficient

  • It is going away in a future release

  • It encourages bad coding practices

Deprecation is a reasonable choice in all these cases because it preserves "backward compatibility" while encouraging developers to change to the new API. Also, the deprecation comments help developers decide when to move to the new API, and so should briefly mention the technical reasons for deprecation.

It is not necessary to deprecate individual member fields (properties) of a deprecated class, unless of course you want to explain a specific point about a property.

https://docs.oracle.com/javase/1.5.0/docs/guide/javadoc/deprecation/deprecation.html