Skip to content

Commit

Permalink
Introduce @Blocking and @nonblocking
Browse files Browse the repository at this point in the history
  • Loading branch information
jreznot committed Aug 11, 2021
1 parent 4f09caf commit 19809f3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
20 changes: 20 additions & 0 deletions common/src/main/java/org/jetbrains/annotations/Blocking.java
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 common/src/main/java/org/jetbrains/annotations/NonBlocking.java
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 {
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# limitations under the License.
#

projectVersion=21.0.1
projectVersion=22.0.0
#JDK_5=<path-to-older-java-version>

0 comments on commit 19809f3

Please sign in to comment.