2016-02-05 75 views
7

所以,人们对已弃用的API使用@Deprecated注释。什么是@deprecated in java的反向

是否有任何注释可以通知用户该方法是否正在发展并且不稳定?

+2

不是内置的,但你可以自己做。像'@ Beta'一样。 – Tunaki

+2

您可以使用[番石榴中的'@ Beta'注释](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/annotations/Beta.html)。 – azurefrog

+1

另请参阅:http://stackoverflow.com/questions/32555597/annotating-unstable-classes-methods-for-javadoc – assylias

回答

4

Afaik,它还不存在,你必须创建自己的。

JEP277定义@Deprecated(EXPERIMENTAL),但它只是一个命题。

2

在hadoop中有InterfaceStability注释用于这些目的。有趣的是这个注释并不稳定。我怀疑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 {}; 
}