-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BWC and API enforcement] Define the initial set of annotations, thei…
…r meaning and relations between them (#9223) * [BWC and API enforcement] Define the initial set of annotations, their meaning and relations between them Signed-off-by: Andriy Redko <andriy.redko@aiven.io> Signed-off-by: Peter Nied <petern@amazon.com> Co-authored-by: Peter Nied <petern@amazon.com>
- Loading branch information
Showing
7 changed files
with
149 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
libs/common/src/main/java/org/opensearch/common/annotation/DeprecatedApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.common.annotation; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Marks the public APIs as deprecated and scheduled for removal in one of the upcoming | ||
* major releases. The types marked with this annotations could only be other {@link PublicApi}s. | ||
* | ||
* @opensearch.api | ||
*/ | ||
@Documented | ||
@Target({ ElementType.TYPE, ElementType.PACKAGE, ElementType.METHOD, ElementType.CONSTRUCTOR }) | ||
@PublicApi(since = "2.10.0") | ||
public @interface DeprecatedApi { | ||
/** | ||
* Version since this API is deprecated | ||
*/ | ||
String since(); | ||
|
||
/** | ||
* Next major version when this API is scheduled for removal | ||
*/ | ||
String forRemoval() default ""; | ||
} |
27 changes: 27 additions & 0 deletions
27
libs/common/src/main/java/org/opensearch/common/annotation/ExperimentalApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.common.annotation; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Experimental APIs that may not retain source and binary compatibility within major, | ||
* minor or patch releases. The types marked with this annotations could only expose | ||
* other {@link PublicApi} or {@link ExperimentalApi} types as public members. | ||
* | ||
* @opensearch.api | ||
*/ | ||
@Documented | ||
@Target({ ElementType.TYPE, ElementType.PACKAGE, ElementType.METHOD, ElementType.CONSTRUCTOR }) | ||
@PublicApi(since = "2.10.0") | ||
public @interface ExperimentalApi { | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
libs/common/src/main/java/org/opensearch/common/annotation/InternalApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.common.annotation; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Internal APIs that have no compatibility guarantees and should be not used outside | ||
* of OpenSearch core components. | ||
* | ||
* @opensearch.api | ||
*/ | ||
@Documented | ||
@Target({ ElementType.TYPE, ElementType.PACKAGE, ElementType.METHOD, ElementType.CONSTRUCTOR }) | ||
@PublicApi(since = "2.10.0") | ||
public @interface InternalApi { | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
libs/common/src/main/java/org/opensearch/common/annotation/PublicApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.common.annotation; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Stable public APIs that retain source and binary compatibility within a major release. | ||
* These interfaces can change from one major release to another major release | ||
* (e.g. from 1.0 to 2.0). The types marked with this annotations could only expose | ||
* other {@link PublicApi} or {@link ExperimentalApi} types as public members. | ||
* | ||
* @opensearch.api | ||
*/ | ||
@Documented | ||
@Target({ ElementType.TYPE, ElementType.PACKAGE, ElementType.METHOD, ElementType.CONSTRUCTOR }) | ||
@PublicApi(since = "2.10.0") | ||
public @interface PublicApi { | ||
/** | ||
* Version when this API was released | ||
*/ | ||
String since(); | ||
} |
15 changes: 15 additions & 0 deletions
15
libs/common/src/main/java/org/opensearch/common/annotation/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
/** | ||
* The OpenSearch API related annotations | ||
* | ||
* @opensearch.api | ||
*/ | ||
@PublicApi(since = "2.10.0") | ||
package org.opensearch.common.annotation; |