Never use deprecated fields, methods, or classes in new code. The Java SE 6 documentation provides a [complete list|http://download.oracle.com/javase/6/docs/api/deprecated- list.html] of deprecated APIs \[ [API 2006|AA. References#API 06]\]. Java also provides a {{ Wiki Markup @deprecated
}} annotation to indicate the deprecation of specific fields, methods, and classes. For instance, many methods of {{java.util.Date
}}, such as {{Date.getYear()
}}, have been explicitly deprecated. Rule [THI05-J. Do not use Thread.stop() to terminate threads] describes issues that can result from using the deprecated {{Thread.stop()
}} method.
Obsolete fields, methods, and classes should not be used. Java lacks any annotation that indicates obsolescence; nevertheless, several classes and methods are documented as obsolete. For instance, the {{ Wiki Markup java.util.Dictionary
}} class is marked as obsolete; new code should use {{java.util.Map<K,V>
}} instead \[ [API 2006|AA. References#API 06]\].
Obsolete Methods and Classes
...
Detecting uses of deprecated methods is straightforward. Obsolete methods have no automatic means of detection.
Related Guidelines
...
http://www.aitcnet.org/isai/] | Deprecated language features [MEM] | ]]></ac:plain-text-body></ac:structured-macro> | |
CWE-589. Call to non-ubiquitous API |
Bibliography
...
[ [API 2006AA. References#API 06]] | [Deprecated APIhttp://java.sun.com/javase/6/docs/api/deprecated-list.html], [ Dictionary | http://download.oracle.com/javase/6/docs/api/java/util/Dictionary.html] | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e64dd8a9-94ab-4ba1-bdba-567dbc2918cb"><ac:plain-text-body><![CDATA[ | [ [SDN 2008AA. References#SDN 08]] | Bug database, [Bug ID 4264153 | http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4264153] | ]]></ac:plain-text-body></ac:structured-macro> |
...