You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by za...@apache.org on 2023/03/15 11:40:19 UTC

[calcite] 01/02: [CALCITE-5571] Remove org.jetbrains.annotations from java source code

This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit 12b7193e4f005e72aee27290bf71f72badd5e7da
Author: Stamatis Zampetakis <za...@gmail.com>
AuthorDate: Thu Mar 9 22:38:30 2023 +0100

    [CALCITE-5571] Remove org.jetbrains.annotations from java source code
    
    The project primarily uses checkerframework annotations (org
    .checkerframework.checker.nullness.qual) for specifying nullability;
    not org.jetbrains.annotations.
    
    To keep things consistent and also avoid mixing up annotations from
    different providers in the future, this commit removes the last
    references to org.jetbrains.annotations and excludes the
    org.jetbrains:annotations dependency from the build to avoid
    accidentally using such annotations in the future.
    
    Close apache/calcite#3102
---
 build.gradle.kts                                                 | 5 +++++
 .../test/java/org/apache/calcite/test/ScannableTableTest.java    | 3 +--
 core/src/test/java/org/apache/calcite/util/UtilTest.java         | 9 ++++-----
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/build.gradle.kts b/build.gradle.kts
index b4bb44ca02..7f3499e43b 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -335,6 +335,11 @@ allprojects {
     val javaUsed = file("src/main/java").isDirectory
     if (javaUsed) {
         apply(plugin = "java-library")
+        configurations {
+            "implementation" {
+                exclude(group = "org.jetbrains", module = "annotations")
+            }
+        }
     }
 
     plugins.withId("java-library") {
diff --git a/core/src/test/java/org/apache/calcite/test/ScannableTableTest.java b/core/src/test/java/org/apache/calcite/test/ScannableTableTest.java
index f038e7030a..ceb9742116 100644
--- a/core/src/test/java/org/apache/calcite/test/ScannableTableTest.java
+++ b/core/src/test/java/org/apache/calcite/test/ScannableTableTest.java
@@ -46,7 +46,6 @@ import org.apache.calcite.util.Pair;
 import com.google.common.collect.ImmutableMap;
 
 import org.checkerframework.checker.nullness.qual.Nullable;
-import org.jetbrains.annotations.NotNull;
 import org.junit.jupiter.api.Test;
 
 import java.math.BigDecimal;
@@ -652,7 +651,7 @@ public class ScannableTableTest {
       @Override public Enumerable<@Nullable Object[]> scan(DataContext root) {
         scanCount.incrementAndGet();
         return new AbstractEnumerable<Object[]>() {
-          @NotNull @Override public Enumerator<Object[]> enumerator() {
+          @Override public Enumerator<Object[]> enumerator() {
             enumerateCount.incrementAndGet();
             final Enumerator<Object[]> enumerator =
                 superScan(root).enumerator();
diff --git a/core/src/test/java/org/apache/calcite/util/UtilTest.java b/core/src/test/java/org/apache/calcite/util/UtilTest.java
index db113d162d..f03eae6cfe 100644
--- a/core/src/test/java/org/apache/calcite/util/UtilTest.java
+++ b/core/src/test/java/org/apache/calcite/util/UtilTest.java
@@ -47,12 +47,11 @@ import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import com.google.common.primitives.Ints;
 
+import org.checkerframework.checker.nullness.qual.Nullable;
 import org.hamcrest.Description;
 import org.hamcrest.Matcher;
 import org.hamcrest.StringDescription;
 import org.hamcrest.TypeSafeMatcher;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 import org.junit.jupiter.api.Test;
 
 import java.io.PrintWriter;
@@ -2054,10 +2053,10 @@ class UtilTest {
   /** Tests {@link ReflectUtil#mightBeAssignableFrom(Class, Class)}. */
   @Test void testMightBeAssignableFrom() {
     final Object myMap = new HashMap<String, Integer>() {
-      @Override public @NotNull Set<Entry<String, Integer>> entrySet() {
+      @Override public Set<Entry<String, Integer>> entrySet() {
         throw new UnsupportedOperationException();
       }
-      @Override public @Nullable Integer put(String key, Integer value) {
+      @Override public Integer put(String key, Integer value) {
         throw new UnsupportedOperationException();
       }
       @Override public int size() {
@@ -2342,7 +2341,7 @@ class UtilTest {
     memo1.close();
     assertThat(local1.get(), is("foo"));
 
-    final TryThreadLocal<@org.checkerframework.checker.nullness.qual.Nullable String> local2 =
+    final TryThreadLocal<@Nullable String> local2 =
         TryThreadLocal.of(null);
     assertThat(local2.get(), nullValue());
     TryThreadLocal.Memo memo2 = local2.push("a");