From 19809f329d96148651fa6825cc54e4453f5a8537 Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Wed, 11 Aug 2021 15:22:35 +0300 Subject: [PATCH] Introduce @Blocking and @NonBlocking --- .../org/jetbrains/annotations/Blocking.java | 20 +++++++++++++++++++ .../jetbrains/annotations/NonBlocking.java | 20 +++++++++++++++++++ gradle.properties | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 common/src/main/java/org/jetbrains/annotations/Blocking.java create mode 100644 common/src/main/java/org/jetbrains/annotations/NonBlocking.java diff --git a/common/src/main/java/org/jetbrains/annotations/Blocking.java b/common/src/main/java/org/jetbrains/annotations/Blocking.java new file mode 100644 index 0000000..f575896 --- /dev/null +++ b/common/src/main/java/org/jetbrains/annotations/Blocking.java @@ -0,0 +1,20 @@ +package org.jetbrains.annotations; + +import java.lang.annotation.*; + +/** + * Indicates that the annotated method is inherently blocking and should not be executed in a non-blocking context. + *

+ * When this annotation is used on a {@code class}, all the methods declared by the annotated class are considered + * blocking. + *

+ * Apart from documentation purposes this annotation is intended to be used by static analysis tools to validate against + * probable runtime errors and element contract violations. + * + * @since 22.0.0 + */ +@Documented +@Retention(RetentionPolicy.CLASS) +@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE}) +public @interface Blocking { +} diff --git a/common/src/main/java/org/jetbrains/annotations/NonBlocking.java b/common/src/main/java/org/jetbrains/annotations/NonBlocking.java new file mode 100644 index 0000000..e64254f --- /dev/null +++ b/common/src/main/java/org/jetbrains/annotations/NonBlocking.java @@ -0,0 +1,20 @@ +package org.jetbrains.annotations; + +import java.lang.annotation.*; + +/** + * Indicates that the annotated method is inherently non-blocking and can be executed in a non-blocking context. + *

+ * When this annotation is used on a {@code class}, all the methods declared by the annotated class are considered + * non-blocking. + *

+ * Apart from documentation purposes this annotation is intended to be used by static analysis tools to validate against + * probable runtime errors and contract violations. + * + * @since 22.0.0 + */ +@Documented +@Retention(RetentionPolicy.CLASS) +@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE}) +public @interface NonBlocking { +} diff --git a/gradle.properties b/gradle.properties index 499e12f..6bf0839 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,5 +14,5 @@ # limitations under the License. # -projectVersion=21.0.1 +projectVersion=22.0.0 #JDK_5= \ No newline at end of file