-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce @Blocking and @nonblocking
- Loading branch information
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
common/src/main/java/org/jetbrains/annotations/Blocking.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,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. | ||
* <p> | ||
* When this annotation is used on a {@code class}, all the methods declared by the annotated class are considered | ||
* <em>blocking</em>. | ||
* <p> | ||
* 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 { | ||
} |
20 changes: 20 additions & 0 deletions
20
common/src/main/java/org/jetbrains/annotations/NonBlocking.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,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. | ||
* <p> | ||
* When this annotation is used on a {@code class}, all the methods declared by the annotated class are considered | ||
* <em>non-blocking</em>. | ||
* <p> | ||
* 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 { | ||
} |
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