Remove more usages of checker's Nullable (#4410)

This commit is contained in:
Nikita Salnikov-Tarnovski 2021-10-18 17:32:25 +03:00 committed by GitHub
parent ae7d48cb07
commit c119fa1bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 23 deletions

View File

@ -9,8 +9,8 @@ import io.opentelemetry.instrumentation.api.internal.shaded.caffeine2.cache.Caff
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.function.Function;
import org.checkerframework.checker.index.qual.NonNegative;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
final class Caffeine2Cache<K, V> implements CaffeineCache<K, V> {
@ -68,12 +68,12 @@ final class Caffeine2Cache<K, V> implements CaffeineCache<K, V> {
}
@Override
public void maximumSize(@NonNegative long maximumSize) {
public void maximumSize(@Nonnegative long maximumSize) {
caffeine.maximumSize(maximumSize);
}
@Override
public void executor(@NonNull Executor executor) {
public void executor(@Nonnull Executor executor) {
caffeine.executor(executor);
}

View File

@ -9,8 +9,8 @@ import io.opentelemetry.instrumentation.api.internal.shaded.caffeine3.cache.Caff
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.function.Function;
import org.checkerframework.checker.index.qual.NonNegative;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
final class Caffeine3Cache<K, V> implements CaffeineCache<K, V> {
@ -78,12 +78,12 @@ final class Caffeine3Cache<K, V> implements CaffeineCache<K, V> {
}
@Override
public void maximumSize(@NonNegative long maximumSize) {
public void maximumSize(@Nonnegative long maximumSize) {
caffeine.maximumSize(maximumSize);
}
@Override
public void executor(@NonNull Executor executor) {
public void executor(@Nonnull Executor executor) {
caffeine.executor(executor);
}

View File

@ -7,8 +7,8 @@ package io.opentelemetry.instrumentation.api.caching;
import java.util.Set;
import java.util.concurrent.Executor;
import org.checkerframework.checker.index.qual.NonNegative;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
interface CaffeineCache<K, V> extends Cache<K, V> {
@ -18,9 +18,9 @@ interface CaffeineCache<K, V> extends Cache<K, V> {
void weakValues();
void maximumSize(@NonNegative long maximumSize);
void maximumSize(@Nonnegative long maximumSize);
void executor(@NonNull Executor executor);
void executor(@Nonnull Executor executor);
Cache<K, V> build();
}

View File

@ -1,8 +1,4 @@
@DefaultQualifier(
value = NonNull.class,
locations = {TypeUseLocation.FIELD, TypeUseLocation.PARAMETER, TypeUseLocation.RETURN})
@ParametersAreNonnullByDefault
package io.opentelemetry.instrumentation.api;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.checkerframework.framework.qual.TypeUseLocation;
import javax.annotation.ParametersAreNonnullByDefault;

View File

@ -16,12 +16,12 @@ import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
import org.bson.BsonArray;
import org.bson.BsonDocument;
import org.bson.BsonValue;
import org.bson.json.JsonWriter;
import org.bson.json.JsonWriterSettings;
import org.checkerframework.checker.nullness.qual.Nullable;
class MongoDbAttributesExtractor extends DbAttributesExtractor<CommandStartedEvent, Void> {
@ -50,17 +50,20 @@ class MongoDbAttributesExtractor extends DbAttributesExtractor<CommandStartedEve
}
@Override
protected @Nullable String user(CommandStartedEvent event) {
@Nullable
protected String user(CommandStartedEvent event) {
return null;
}
@Override
protected @Nullable String name(CommandStartedEvent event) {
@Nullable
protected String name(CommandStartedEvent event) {
return event.getDatabaseName();
}
@Override
protected @Nullable String connectionString(CommandStartedEvent event) {
@Nullable
protected String connectionString(CommandStartedEvent event) {
ConnectionDescription connectionDescription = event.getConnectionDescription();
if (connectionDescription != null) {
ServerAddress sa = connectionDescription.getServerAddress();
@ -82,7 +85,8 @@ class MongoDbAttributesExtractor extends DbAttributesExtractor<CommandStartedEve
}
@Override
protected @Nullable String operation(CommandStartedEvent event) {
@Nullable
protected String operation(CommandStartedEvent event) {
return event.getCommandName();
}