Skip to content

Commit 8371fa1

Browse files
authored
Update Sdk annotations to add Documented annotation and update documentation (#6503)
1 parent 16dd479 commit 8371fa1

File tree

7 files changed

+70
-51
lines changed

7 files changed

+70
-51
lines changed

core/annotations/src/main/java/software/amazon/awssdk/annotations/ReviewBeforeRelease.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

core/annotations/src/main/java/software/amazon/awssdk/annotations/SdkInternalApi.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,23 @@
1515

1616
package software.amazon.awssdk.annotations;
1717

18+
import java.lang.annotation.Documented;
1819
import java.lang.annotation.ElementType;
1920
import java.lang.annotation.Target;
2021

2122
/**
22-
* Marker interface for 'internal' APIs that should not be used outside the same module. Breaking
23-
* changes can and will be introduced to elements marked as {@link SdkInternalApi}. Users of the SDK
24-
* and the generated clients themselves should not depend on any packages, types, fields,
25-
* constructors, or methods with this annotation.
23+
* Marks APIs that should not be used by SDK users and are internal to the AWS SDK for Java v2, subject to change without notice.
24+
*
25+
* <p><b>WARNING:</b> Elements annotated with {@code @SdkInternalApi} are not part of the public API.
26+
* They may be modified or removed in any release without warning, including minor and patch releases.
27+
*
28+
* <p><b>Intended for:</b> Internal SDK implementation only. This annotation indicates that the
29+
* marked element should not be used outside its defining module.
30+
*
31+
* @see SdkProtectedApi
32+
* @see SdkPublicApi
2633
*/
34+
@Documented
2735
@Target({ElementType.PACKAGE, ElementType.TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD})
2836
@SdkProtectedApi
2937
public @interface SdkInternalApi {

core/annotations/src/main/java/software/amazon/awssdk/annotations/SdkPreviewApi.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,26 @@
1919
import java.lang.annotation.Target;
2020

2121
/**
22-
* Marker interface for preview and experimental APIs. Breaking changes may be
23-
* introduced to elements marked as {@link SdkPreviewApi}. Users of the SDK
24-
* should assume that anything annotated as preview will change or break, and
25-
* <b>should not</b> use them in production.
22+
* Marks APIs as preview or experimental features that may change or be removed.
23+
*
24+
* <p><b>WARNING:</b> Elements annotated with {@code @SdkPreviewApi} are not stable and may
25+
* introduce breaking changes in any release, including minor and patch versions. Do not use
26+
* preview APIs in production environments.
27+
*
28+
* <p><b>Use with caution:</b>
29+
* <ul>
30+
* <li>Preview APIs are suitable for testing and providing feedback</li>
31+
* <li>They may change significantly based on user feedback</li>
32+
* <li>They may be promoted to public APIs or removed entirely</li>
33+
* <li>No backward compatibility is guaranteed</li>
34+
* </ul>
35+
*
36+
* <p><b>Intended for:</b> Early adopters and developers who want to experiment with new features
37+
* and provide feedback before they become stable public APIs.
38+
*
39+
* @see SdkPublicApi
40+
* @see SdkProtectedApi
41+
* @see SdkInternalApi
2642
*/
2743
@Target({ElementType.PACKAGE, ElementType.TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD})
2844
@SdkProtectedApi

core/annotations/src/main/java/software/amazon/awssdk/annotations/SdkProtectedApi.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,26 @@
1515

1616
package software.amazon.awssdk.annotations;
1717

18+
import java.lang.annotation.Documented;
1819
import java.lang.annotation.ElementType;
1920
import java.lang.annotation.Target;
2021

2122
/**
22-
* Marker for elements that should only be accessed by the generated clients and not users of the
23-
* SDK. Do not make breaking changes to these APIs - they won't directly break customers, but
24-
* they'll break old versions of generated clients.
25-
* <p>
26-
* TODO: Write a linter that makes sure generated code only depends on public or
27-
* {@code @InternalApi} classes.
23+
* Marks APIs that should not be used by SDK users and are intended for SDK internal classes shared across different modules.
24+
*
25+
* <p><b>IMPORTANT:</b> Elements annotated with {@code @SdkProtectedApi} must maintain backward
26+
* compatibility. Breaking changes will break older versions of generated clients, even if they don't directly impact SDK users.
27+
*
28+
* <p><b>Intended for:</b> Generated service clients and internal SDK modules that support them.
29+
* These APIs form the contract between the SDK core and generated code.
30+
*
31+
* <p><b>Stability guarantee:</b> Protected APIs should not introduce breaking changes, as this
32+
* would require regenerating and redeploying all service clients.
33+
*
34+
* @see SdkInternalApi
35+
* @see SdkPublicApi
2836
*/
37+
@Documented
2938
@Target({ElementType.PACKAGE, ElementType.TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD})
3039
@SdkProtectedApi
3140
public @interface SdkProtectedApi {

core/annotations/src/main/java/software/amazon/awssdk/annotations/SdkPublicApi.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,30 @@
1515

1616
package software.amazon.awssdk.annotations;
1717

18+
import java.lang.annotation.Documented;
1819
import java.lang.annotation.ElementType;
1920
import java.lang.annotation.Target;
2021

2122
/**
22-
* Marker interface for 'public' APIs.
23+
* Marks APIs as public and stable for use by SDK users building applications.
24+
*
25+
* <p><b>Stability guarantee:</b> Elements annotated with {@code @SdkPublicApi} are backward
26+
* compatible.
27+
*
28+
* <p><b>Safe to use for:</b>
29+
* <ul>
30+
* <li>Application code that depends on the AWS SDK</li>
31+
* <li>Libraries that build on top of the SDK</li>
32+
* <li>Any code requiring stable, long-term API contracts</li>
33+
* </ul>
34+
*
35+
* <p><b>Intended for:</b> SDK users and external developers. These APIs form the official public
36+
* interface of the AWS SDK for Java v2.
37+
*
38+
* @see SdkProtectedApi
39+
* @see SdkInternalApi
2340
*/
41+
@Documented
2442
@Target({ElementType.PACKAGE, ElementType.TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD})
2543
@SdkProtectedApi
2644
public @interface SdkPublicApi {

core/annotations/src/main/java/software/amazon/awssdk/annotations/SdkTestInternalApi.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
package software.amazon.awssdk.annotations;
1717

18+
import java.lang.annotation.Documented;
1819
import java.lang.annotation.ElementType;
1920
import java.lang.annotation.Target;
2021

@@ -27,6 +28,7 @@
2728
* TODO: Write a linter that makes sure only test code depends on methods or constructors annotated
2829
* with this method
2930
*/
31+
@Documented
3032
@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD, ElementType.TYPE})
3133
@SdkProtectedApi
3234
public @interface SdkTestInternalApi {

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,10 +687,10 @@
687687
</includeModules>
688688
<excludes>
689689
<exclude>*.internal.*</exclude>
690+
<!-- TODO remove after release -->
691+
<exclude>software.amazon.awssdk.annotations.ReviewBeforeRelease</exclude>
690692
<exclude>software.amazon.awssdk.thirdparty.*</exclude>
691693
<exclude>software.amazon.awssdk.regions.*</exclude>
692-
<!-- TODO remove after release -->
693-
<exclude>software.amazon.awssdk.awscore.interceptor.TraceIdExecutionInterceptor</exclude>
694694
</excludes>
695695

696696
<ignoreMissingOldVersion>true</ignoreMissingOldVersion>

0 commit comments

Comments
 (0)