Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions sdk-platform-java/gax-java/gax-grpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@
<artifactId>grpc-googleapis</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
Comment on lines -84 to -88

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here


<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>nativeimage</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

Expand Down Expand Up @@ -665,7 +664,6 @@ public GrpcCallContext withRequestParamsDynamicHeaderOption(String requestParams

/** {@inheritDoc} */
@Override
@Nonnull
public ApiTracer getTracer() {
ApiTracer tracer = callOptions.getOption(TRACER_KEY);
if (tracer == null) {
Expand All @@ -676,7 +674,7 @@ public ApiTracer getTracer() {

/** {@inheritDoc} */
@Override
public GrpcCallContext withTracer(@Nonnull ApiTracer tracer) {
public GrpcCallContext withTracer(ApiTracer tracer) {
Preconditions.checkNotNull(tracer);
return withCallOptions(callOptions.withOption(TRACER_KEY, tracer));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import com.google.longrunning.Operation;
import com.google.longrunning.stub.OperationsStub;
import io.grpc.MethodDescriptor;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;

/** Class with utility methods to create grpc-based direct callables. */
Expand Down Expand Up @@ -330,7 +329,7 @@ ClientStreamingCallable<RequestT, ResponseT> createClientStreamingCallable(
}

@VisibleForTesting
static ApiTracerContext getApiTracerContext(@Nonnull MethodDescriptor<?, ?> methodDescriptor) {
static ApiTracerContext getApiTracerContext(MethodDescriptor<?, ?> methodDescriptor) {
return ApiTracerContext.newBuilder()
.setFullMethodName(methodDescriptor.getFullMethodName())
.setTransport(ApiTracerContext.Transport.GRPC)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;

Expand All @@ -68,21 +67,19 @@ void testRetryNoRaceCondition() throws Exception {
ManagedChannelBuilder.forAddress("localhost", 1234).usePlaintext().build();
StreamResumptionStrategy<Color, Money> resumptionStrategy =
new StreamResumptionStrategy<Color, Money>() {
@Nonnull

@Override
public StreamResumptionStrategy<Color, Money> createNew() {
return this;
}

@Nonnull
@Override
public Money processResponse(Money response) {
return response;
}

@Nullable
@Override
public Color getResumeRequest(Color originalRequest) {
public @Nullable Color getResumeRequest(Color originalRequest) {
return originalRequest;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -560,8 +560,7 @@ void testWithDefaultDirectPathServiceConfig() {
assertThat(lbConfig.keySet()).containsExactly("pick_first");
}

@Nullable
private static Map<String, ?> getAsObject(Map<String, ?> json, String key) {
private static @Nullable Map<String, ?> getAsObject(Map<String, ?> json, String key) {
Object mapObject = json.get(key);
if (mapObject == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import io.grpc.ClientCall;
import io.grpc.Metadata;
import io.grpc.Status;
import javax.annotation.Nullable;
import org.jspecify.annotations.Nullable;

public class MockClientCall<RequestT, ResponseT> extends ClientCall<RequestT, ResponseT> {

Expand Down
6 changes: 1 addition & 5 deletions sdk-platform-java/gax-java/gax-httpjson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value-annotations</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

Expand Down Expand Up @@ -588,7 +587,6 @@ public HttpJsonCallContext withDeadline(org.threeten.bp.Instant newDeadline) {
return withCallOptions(builder.setDeadline(newDeadline).build());
}

@Nonnull
@Override
public ApiTracer getTracer() {
if (tracer == null) {
Expand All @@ -599,7 +597,7 @@ public ApiTracer getTracer() {

/** {@inheritDoc} */
@Override
public HttpJsonCallContext withTracer(@Nonnull ApiTracer newTracer) {
public HttpJsonCallContext withTracer(ApiTracer newTracer) {
Preconditions.checkNotNull(newTracer);
HttpJsonCallOptions newCallOptions = callOptions.toBuilder().setTracer(newTracer).build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import com.google.api.gax.rpc.UnaryCallable;
import com.google.api.gax.tracing.ApiTracerContext;
import com.google.api.gax.tracing.TracedUnaryCallable;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;

/** Class with utility methods to create http/json-based direct callables. */
Expand Down Expand Up @@ -222,7 +221,7 @@ ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable(
return callable.withDefaultCallContext(clientContext.getDefaultCallContext());
}

static ApiTracerContext getApiTracerContext(@Nonnull ApiMethodDescriptor<?, ?> methodDescriptor) {
static ApiTracerContext getApiTracerContext(ApiMethodDescriptor<?, ?> methodDescriptor) {
return ApiTracerContext.newBuilder()
.setFullMethodName(methodDescriptor.getFullMethodName())
.setHttpMethod(methodDescriptor.getHttpMethod())
Expand Down
6 changes: 1 addition & 5 deletions sdk-platform-java/gax-java/gax/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
Comment on lines -64 to -68

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qq, why is this dep removed?


<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>nativeimage</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

Expand Down Expand Up @@ -503,7 +502,7 @@ void add(
totalThrottledTimeMs += throttledTimeMs;
}

void setResponseFuture(@Nonnull ApiFuture<ResponseT> responseFuture) {
void setResponseFuture(ApiFuture<ResponseT> responseFuture) {
Preconditions.checkNotNull(responseFuture);
this.responseFuture = responseFuture;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import com.google.api.gax.tracing.ApiTracer;
import com.google.api.gax.tracing.BaseApiTracer;
import java.util.Set;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;

/**
Expand All @@ -50,7 +49,6 @@ public static RetryingContext create() {
}

/** {@inheritDoc} */
@Nonnull
@Override
public ApiTracer getTracer() {
return BaseApiTracer.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.google.api.gax.rpc.StatusCode;
import com.google.api.gax.tracing.ApiTracer;
import java.util.Set;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

Expand All @@ -46,7 +45,6 @@
@BetaApi("The surface for passing per operation state is not yet stable")
public interface RetryingContext {
/** Returns the {@link ApiTracer} associated with the current operation. */
@Nonnull
ApiTracer getTracer();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import com.google.api.core.BetaApi;
import com.google.api.core.InternalExtensionOnly;
import java.util.concurrent.Callable;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;

/**
Expand All @@ -46,6 +45,5 @@
@BetaApi("The surface for per invocation state is unstable and will probably change in the future")
@InternalExtensionOnly
public interface RetryingExecutorWithContext<ResponseT> extends RetryingExecutor<ResponseT> {
RetryingFuture<ResponseT> createFuture(
@Nonnull Callable<ResponseT> callable, @Nonnull RetryingContext context);
RetryingFuture<ResponseT> createFuture(Callable<ResponseT> callable, RetryingContext context);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.google.api.gax.retrying;

import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

Expand All @@ -43,7 +42,6 @@
public interface StreamResumptionStrategy<RequestT, ResponseT> {

/** Creates a new instance of this StreamResumptionStrategy without accumulated state */
@Nonnull
StreamResumptionStrategy<RequestT, ResponseT> createNew();

/**
Expand All @@ -60,7 +58,6 @@ public interface StreamResumptionStrategy<RequestT, ResponseT> {
* through this method.
* </ol>
*/
@Nonnull
ResponseT processResponse(ResponseT response);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

Expand Down Expand Up @@ -175,7 +174,6 @@ public interface ApiCallContext extends RetryingContext {
* events like retries.
*/
@BetaApi("The surface for tracing is not stable yet and may change in the future")
@Nonnull
ApiTracer getTracer();

/**
Expand All @@ -187,7 +185,7 @@ public interface ApiCallContext extends RetryingContext {
* @param tracer the {@link ApiTracer} to set.
*/
@BetaApi("The surface for tracing is not stable yet and may change in the future")
ApiCallContext withTracer(@Nonnull ApiTracer tracer);
ApiCallContext withTracer(ApiTracer tracer);

/**
* Returns a new ApiCallContext with the given {@link RetrySettings} set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

Expand Down Expand Up @@ -106,13 +105,11 @@ public abstract class ClientContext {
public abstract @Nullable Watchdog getStreamWatchdog();

/** This method is obsolete. Use {@link #getStreamWatchdogCheckIntervalDuration()} instead. */
@Nonnull
@ObsoleteApi("Use getStreamWatchdogCheckIntervalDuration() instead")
public final org.threeten.bp.Duration getStreamWatchdogCheckInterval() {
return toThreetenDuration(getStreamWatchdogCheckIntervalDuration());
}

@Nonnull
public abstract java.time.Duration getStreamWatchdogCheckIntervalDuration();

public abstract @Nullable String getUniverseDomain();
Expand All @@ -126,7 +123,6 @@ public final org.threeten.bp.Duration getStreamWatchdogCheckInterval() {

/** Gets the {@link ApiTracerFactory} that will be used to generate traces for operations. */
@BetaApi("The surface for tracing is not stable yet and may change in the future.")
@Nonnull
public abstract ApiTracerFactory getTracerFactory();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import com.google.common.base.MoreObjects;
import java.io.IOException;
import java.util.concurrent.Executor;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

Expand Down Expand Up @@ -121,13 +120,11 @@
}

/** This method is obsolete. Use {@link #getWatchdogCheckIntervalDuration()} instead. */
@Nonnull
@ObsoleteApi("Use getWatchdogCheckIntervalDuration() instead")
public final org.threeten.bp.Duration getWatchdogCheckInterval() {
return stubSettings.getStreamWatchdogCheckInterval();
}

@Nonnull
public final java.time.Duration getWatchdogCheckIntervalDuration() {
return stubSettings.getStreamWatchdogCheckIntervalDuration();
}
Expand Down Expand Up @@ -296,7 +293,7 @@
}

public B setWatchdogCheckIntervalDuration(java.time.@Nullable Duration checkInterval) {
stubSettings.setStreamWatchdogCheckIntervalDuration(checkInterval);

Check warning on line 296 in sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/rpc/ClientSettings.java

View check run for this annotation

SonarQubeCloud / [gapic-generator-java-root] SonarCloud Code Analysis

Annotate the parameter with @javax.annotation.Nullable in method 'setStreamWatchdogCheckIntervalDuration' declaration, or make sure that null can not be passed as argument.

See more on https://sonarcloud.io/project/issues?id=googleapis_google-cloud-java_showcase&issues=AZ-zn8_Vpueqzc71R5kX&open=AZ-zn8_Vpueqzc71R5kX&pullRequest=13959
return self();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import com.google.api.core.ObsoleteApi;
import java.time.Duration;
import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

Expand Down Expand Up @@ -64,7 +63,7 @@ public boolean needsClock() {
}

@Override
public WatchdogProvider withClock(@Nonnull ApiClock clock) {
public WatchdogProvider withClock(ApiClock clock) {
throw new UnsupportedOperationException("FixedWatchdogProvider doesn't need a clock");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import com.google.api.core.ObsoleteApi;
import com.google.common.base.Preconditions;
import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nonnull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

Expand Down Expand Up @@ -72,7 +71,7 @@
}

@Override
public WatchdogProvider withClock(@Nonnull ApiClock clock) {
public WatchdogProvider withClock(ApiClock clock) {
return new InstantiatingWatchdogProvider(
Preconditions.checkNotNull(clock), executor, checkInterval);
}
Expand All @@ -87,12 +86,12 @@
*/
@Override
@ObsoleteApi("Use withCheckIntervalDuration(java.time.Duration) instead")
public WatchdogProvider withCheckInterval(@Nonnull org.threeten.bp.Duration checkInterval) {
public WatchdogProvider withCheckInterval(org.threeten.bp.Duration checkInterval) {
return withCheckIntervalDuration(toJavaTimeDuration(checkInterval));

Check warning on line 90 in sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/rpc/InstantiatingWatchdogProvider.java

View check run for this annotation

SonarQubeCloud / [gapic-generator-java-root] SonarCloud Code Analysis

Annotate the parameter with @javax.annotation.Nullable in method 'withCheckIntervalDuration' declaration, or make sure that null can not be passed as argument.

See more on https://sonarcloud.io/project/issues?id=googleapis_google-cloud-java_showcase&issues=AZ-zn89cpueqzc71R5kW&open=AZ-zn89cpueqzc71R5kW&pullRequest=13959
}

@Override
public WatchdogProvider withCheckIntervalDuration(@Nonnull java.time.Duration checkInterval) {
public WatchdogProvider withCheckIntervalDuration(java.time.Duration checkInterval) {
return new InstantiatingWatchdogProvider(
clock, executor, Preconditions.checkNotNull(checkInterval));
}
Expand Down
Loading
Loading