Skip to content

Commit

Permalink
[CALCITE-5571] Remove org.jetbrains.annotations from java source code
Browse files Browse the repository at this point in the history
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#3102
  • Loading branch information
zabetak committed Mar 15, 2023
1 parent 627e067 commit 12b7193
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
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;
Expand Down Expand Up @@ -652,7 +651,7 @@ private Enumerable<Object[]> superScan(DataContext root) {
@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();
Expand Down
9 changes: 4 additions & 5 deletions core/src/test/java/org/apache/calcite/util/UtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@
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;
Expand Down Expand Up @@ -2054,10 +2053,10 @@ private NavigableSet<String> checkNav(NavigableSet<String> set, String s) {
/** 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() {
Expand Down Expand Up @@ -2342,7 +2341,7 @@ private void checkListToString(String... strings) {
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");
Expand Down

0 comments on commit 12b7193

Please sign in to comment.