[Git][java-team/intellij-annotations][upstream] New upstream version 23.0.0
Markus Koschany (@apo)
gitlab at salsa.debian.org
Mon Nov 15 10:46:01 GMT 2021
Markus Koschany pushed to branch upstream at Debian Java Maintainers / intellij-annotations
Commits:
6128956e by Markus Koschany at 2021-11-15T11:40:45+01:00
New upstream version 23.0.0
- - - - -
8 changed files:
- CHANGELOG.md
- README.md
- common/src/main/java/org/intellij/lang/annotations/MagicConstant.java
- common/src/main/java/org/jetbrains/annotations/Blocking.java
- common/src/main/java/org/jetbrains/annotations/NonBlocking.java
- gradle.properties
- + java8/src/main/java/org/jetbrains/annotations/BlockingExecutor.java
- + java8/src/main/java/org/jetbrains/annotations/NonBlockingExecutor.java
Changes:
=====================================
CHANGELOG.md
=====================================
@@ -1,6 +1,10 @@
Changelog
===
+Version 23.0.0
+---
+* Added new annotations: `@BlockingExecutor` and `@NonBlockingExecutor`.
+
Version 22.0.0
---
* Added new annotations: `@Blocking` and `@NonBlocking`.
=====================================
README.md
=====================================
@@ -16,7 +16,7 @@ The annotations are published on [Maven Central](https://repo1.maven.org/maven2/
using gradle write the following in the `build.gradle` file:
```
dependencies {
- compileOnly 'org.jetbrains:annotations:21.0.1'
+ compileOnly 'org.jetbrains:annotations:23.0.0'
}
```
@@ -25,7 +25,7 @@ To add a dependency using Maven, write the following in `pom.xml`:
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
- <version>21.0.1</version>
+ <version>23.0.0</version>
<scope>provided</scope>
</dependency>
```
=====================================
common/src/main/java/org/intellij/lang/annotations/MagicConstant.java
=====================================
@@ -115,7 +115,7 @@ public @interface MagicConstant {
long[] flags() default {};
/**
- * @return allowed values which are defined in the specified class public static final constants.
+ * @return allowed values which are defined in the specified class static final constants.
*
* E.g.
* <pre>
@@ -129,7 +129,7 @@ public @interface MagicConstant {
Class<?> valuesFromClass() default void.class;
/**
- * @return allowed int flags which are defined in the specified class public static final constants.
+ * @return allowed int flags which are defined in the specified class static final constants.
* The difference from the {@link #valuesFromClass()} is that flags are allowed to be combined (via plus:+ or bitwise OR: |) whereas values aren't.
* The literals "0" and "-1" are also allowed to denote absence and presense of all flags respectively.
*
=====================================
common/src/main/java/org/jetbrains/annotations/Blocking.java
=====================================
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2000-2021 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jetbrains.annotations;
import java.lang.annotation.*;
=====================================
common/src/main/java/org/jetbrains/annotations/NonBlocking.java
=====================================
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2000-2021 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jetbrains.annotations;
import java.lang.annotation.*;
=====================================
gradle.properties
=====================================
@@ -14,5 +14,5 @@
# limitations under the License.
#
-projectVersion=22.0.0
+projectVersion=23.0.0
#JDK_5=<path-to-older-java-version>
\ No newline at end of file
=====================================
java8/src/main/java/org/jetbrains/annotations/BlockingExecutor.java
=====================================
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2000-2021 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.annotations;
+
+import java.lang.annotation.*;
+
+/**
+ * Indicates that the annotated executor (CoroutineContext, Scheduler)
+ * allows blocking methods execution.
+ * <p>
+ * If a given executor does not allow blocking calls, {@link NonBlockingExecutor} should be used.
+ *
+ * <p>
+ * Example 1 (Kotlin coroutines):
+ * <pre><code>
+ * class BlockingExampleService {
+ * val dispatcher: @BlockingExecutor CoroutineContext
+ * get() { ... }
+ *
+ * suspend fun foo() {
+ * val result = withContext(dispatcher) {
+ * blockingBuzz() // no IDE warning
+ * }
+ * }
+ *
+ * @Blocking fun blockingBuzz() { ... }
+ * }
+ * </code></pre>
+ *
+ * <p>
+ * Example 2 (Java with Reactor framework):
+ * <pre><code>
+ * class BlockingExampleService {
+ * private static final @BlockingExecutor Scheduler blockingScheduler =
+ * Schedulers.newBoundedElastic(4, 10, "executor");
+ *
+ * public Flux<String> foo(Flux<String> urls) {
+ * return urls.publishOn(blockingScheduler)
+ * .map(url -> blockingBuzz(url)); // no IDE warning
+ * }
+ *
+ * @Blocking
+ * private String blockingBuzz(String url) { ... }
+ * }
+ * </code></pre>
+ *
+ * @see Blocking
+ * @see NonBlocking
+ */
+ at Documented
+ at Retention(RetentionPolicy.CLASS)
+ at Target({ElementType.TYPE, ElementType.TYPE_USE})
+public @interface BlockingExecutor {
+}
=====================================
java8/src/main/java/org/jetbrains/annotations/NonBlockingExecutor.java
=====================================
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2000-2021 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.annotations;
+
+import java.lang.annotation.*;
+
+/**
+ * Indicates that the annotated executor (CoroutineContext, Scheduler)
+ * does not allow blocking methods execution.
+ *
+ * <p>
+ * If a given executor allows blocking calls, {@link BlockingExecutor} should be used.
+ *
+ * <p>
+ * Example 1 (Kotlin coroutines):
+ * <pre><code>
+ * class NonBlockingExampleService {
+ * val dispatcher: @NonBlockingExecutor CoroutineContext
+ * get() { ... }
+ *
+ * suspend fun foo() {
+ * val result = withContext(dispatcher) {
+ * blockingBuzz() // IDE warning: `Possibly blocking call in non-blocking context`
+ * }
+ * }
+ *
+ * @Blocking fun blockingBuzz() { ... }
+ * }
+ * </code></pre>
+ *
+ * <p>
+ * Example 2 (Java with Reactor framework):
+ * <pre><code>
+ * class NonBlockingExampleService {
+ * private static final @NonBlockingExecutor Scheduler operationsScheduler =
+ * Schedulers.newParallel("parallel");
+ *
+ * public Flux<String> foo(Flux<String> urls) {
+ * return urls.publishOn(operationsScheduler)
+ * .filter(url -> blockingBuzz(url) != null); // IDE warning: `Possibly blocking call in non-blocking context`
+ * }
+ *
+ * @Blocking
+ * private String blockingBuzz(String url) { ... }
+ * }
+ * </code></pre>
+ * @see Blocking
+ * @see NonBlocking
+ */
+ at Documented
+ at Retention(RetentionPolicy.CLASS)
+ at Target({ElementType.TYPE, ElementType.TYPE_USE})
+public @interface NonBlockingExecutor {
+}
View it on GitLab: https://salsa.debian.org/java-team/intellij-annotations/-/commit/6128956e7e800332db2481bdf80066bb7b52f3b7
--
View it on GitLab: https://salsa.debian.org/java-team/intellij-annotations/-/commit/6128956e7e800332db2481bdf80066bb7b52f3b7
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20211115/1c91e573/attachment.htm>
More information about the pkg-java-commits
mailing list