Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is reverse of @deprecated in java [duplicate]

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?

like image 958
debarshi Avatar asked Feb 05 '16 16:02

debarshi


People also ask

How do I deprecate a method in Java?

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

What is a deprecation warning in Java?

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:

What is the difference between @DEP deprecated and @deprecated in Javadoc?

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

What is deprecated annotation in Java?

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.


2 Answers

Afaik, it doesn't exist yet, you have to create your own.

JEP277 define a @Deprecated(EXPERIMENTAL), but it's just a proposition.

like image 161
Jérémie B Avatar answered Oct 16 '22 15:10

Jérémie B


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 {};
}
like image 2
AdamSkywalker Avatar answered Oct 16 '22 16:10

AdamSkywalker