Java Operators

Java Control Statements

Object Oriented Programming

Java Built-in Classes

Java File Handling

Java Error & Exceptions

Java Multithreading

Java Synchronization

Java Networking

Java Collections

Java Interfaces

Java Data Structures

Java Collections Algorithms

Advanced Java

Java Miscellaneous

Java APIs & Frameworks

Java Class References

Java Useful Resources

Java - Enhanced @Deprecated Annotation



@Deprecated annotation was introduced in java 5 version. A program element annotated with @Deprecated means it should not be used for any of the following reasons −

  • Its usage may leads to errors.
  • It may be incompatible in future version.
  • It may be removed in future version.
  • A better and efficient alternative has superseeded it.

Compiler generates warnings whenever a deprecated element is used. With Java 9, two new enhancements are made to @Deprecated annotation.

  • forRemoval − Indicates whether the annotated element is subject to removal in a future version. The default value is false.

  • since − Returns the version in which the annotated element became deprecated. The default value is the empty string.

Deprecated with since

Following example of Boolean class javadoc on Java 9 illustrate the use of since attribute on @Deprecated annotation.

Boolean Class

Boolean Class javadoc

Deprecated with forRemoval

Following example of System class javadoc on Java 9 illustrate the use of forRemoval attribute on @Deprecated annotation.

System Class

System Class javadoc
Advertisements
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy