Annotating Unstable Classes/Methods for Javadoc

后端 未结 1 1060
一个人的身影
一个人的身影 2021-01-18 04:05

When developing new classes/methods for a Java project, you sometimes want to let people try out your new code but don\'t want to guarantee it will be backwards-compatible i

相关标签:
1条回答
  • 2021-01-18 04:50

    No, there is no standard for such a feature in Java.

    To add this information to the generated Javadoc you can use @Documented on your own annotation.

    import java.lang.annotation.Documented;
    
    @Documented
    public @interface Unstable {
    }
    

    With this the annotation will appear in the Javadoc of the annotated type, field, method, etc.

    public interface AlwaysChangingApi {
        @Unstable
        String process(String someParameter);
    }
    
    0 讨论(0)
提交回复
热议问题