Skip to content

Commit f84a7fb

Browse files
committed
API annotation updates
1 parent 30ef2fc commit f84a7fb

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.falsepattern.lib;
2+
3+
import java.lang.annotation.Documented;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
7+
/**
8+
* Used together with {@link Deprecated} to specify when an API was marked stable, and when it was marked for deprecation.
9+
* Deprecated classes MAY be removed after a full deprecation cycle as described inside the {@link StableAPI} javadoc.
10+
*/
11+
@Documented
12+
@Retention(RetentionPolicy.RUNTIME)
13+
@StableAPI(since = "0.10.0")
14+
public @interface DeprecationDetails {
15+
@StableAPI(since = "0.10.0")
16+
String stableSince() default "";
17+
@StableAPI(since = "0.10.0")
18+
String deprecatedSince();
19+
}

src/main/java/com/falsepattern/lib/StableAPI.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,18 @@
3131
* If a class or method is NOT annotated with this annotation, it will be considered unstable, and the package/method
3232
* arguments/etc. can freely change between patch releases without notice.
3333
* <p>
34-
* If a class is annotated with this annotation, all currently existing public and protected members in the class will
35-
* be considered stable.
34+
* NOTICE: You should no longer use this annotation exclusively on classes themselves, and instead, annotate every single
35+
* public or protected member you want to expose as a public API!
3636
* <p>
3737
* Private members will never be considered stable, and can be removed without notice.
3838
*/
3939
@Documented
40-
@Retention(RetentionPolicy.CLASS)
40+
@Retention(RetentionPolicy.RUNTIME)
4141
@StableAPI(since = "0.6.0")
4242
public @interface StableAPI {
43+
/**
44+
* The version this API was introduced/stabilized in. Used for library version tracking.
45+
*/
46+
@StableAPI(since = "0.6.0")
4347
String since();
4448
}

0 commit comments

Comments
 (0)