So, People use @Deprecated
annotation for APIs that have been deprecated.
Is there any annotation that notifies users if the method is evolving and is not stable?
We use the @Deprecated annotation to deprecate a method, class, or field, and the @deprecated Javadoc tag in the comment section to inform the developer about the reason for deprecation and what can be used in its place. 1. Deprecated interface: 2. Deprecated class 3. Deprecating a method
When a type, method, field or constructor is annotated with the @Deprecated a nnotation, the compiler will issue a deprecation warning if the deprecated element is used (e.g. invoked, referenced, or overridden). For example, if we call the doSomethingWeird () of the Bar class above like this:
The @deprecated tag must be followed by a space or newline. @Deprecated Using the @Deprecated annotation to deprecate a class, method, or field ensures that all compilers will issue warnings when code uses that program element. In contrast, there is no guarantee that all compilers will always issue warnings based on the @deprecated Javadoc tag
In Java, @Deprecated is an annotation that helps in informing the compiler that the specific class, method, or field is no longer in use since it is ceased or superseded. Moreover, a warning should be given when anyone tries to use it.
Afaik, it doesn't exist yet, you have to create your own.
JEP277 define a @Deprecated(EXPERIMENTAL)
, but it's just a proposition.
In hadoop there is InterfaceStability
annotation for these purposes. The funny thing is this annotation is not stable. I doubt such thing can appear in JDK.
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class InterfaceStability {
/**
* Can evolve while retaining compatibility for minor release boundaries.;
* can break compatibility only at major release (ie. at m.0).
*/
@Documented
public @interface Stable {};
/**
* Evolving, but can break compatibility at minor release (i.e. m.x)
*/
@Documented
public @interface Evolving {};
/**
* No guarantee is provided as to reliability or stability across any
* level of release granularity.
*/
@Documented
public @interface Unstable {};
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With