Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5a85552
testing automation tool on gax
nnicolee Jul 16, 2026
9f25a79
running automation tool on gax-java
nnicolee Jul 16, 2026
f4e63af
feat(gax): refactor javax to jspecify type-use null annotations
nnicolee Jul 17, 2026
471b684
testing automation tool on gax
nnicolee Jul 16, 2026
1887dc5
running automation tool on gax-java
nnicolee Jul 16, 2026
7a0c69e
feat(gax): refactor javax to jspecify type-use null annotations
nnicolee Jul 17, 2026
805997e
Merge branch 'main' into feat/jspecify-gax-auth
nnicolee Jul 17, 2026
81b33cf
Merge branch 'main' into feat/jspecify-gax-auth
nnicolee Jul 17, 2026
1ca35b7
Merge branch 'feat/jspecify-gax-auth' of github.com:googleapis/google…
nnicolee Jul 17, 2026
ce4b81b
declare jspecify dependencies
nnicolee Jul 17, 2026
84806ee
test: disable copying annotations on mocks for Java 8 for sdk-platfor…
nnicolee Jul 17, 2026
178b92a
fix previous errors on disabling copying annotations
nnicolee Jul 17, 2026
629620a
fix further for disable copying annotations
nnicolee Jul 17, 2026
5b6153c
Merge branch 'feat/jspecify-gax-auth' of github.com:googleapis/google…
nnicolee Jul 17, 2026
a11f36e
test: disable copying annotations on ApiTracerContext mocks for Java …
nnicolee Jul 17, 2026
5214eb8
test(bigtable): fix remaining JSpecify CI issues on Java 8
lqiu96 Jul 17, 2026
20bbada
more disable mock annotation copying
nnicolee Jul 17, 2026
8b73c7d
fixed the remaining mocks
nnicolee Jul 17, 2026
e333068
Merge branch 'fix-jspecify-ci-bigtable-mockito' into pr-13799
lqiu96 Jul 17, 2026
7c99224
fixed the rest of the mocks
nnicolee Jul 17, 2026
91c37e8
Merge branch 'main' into feat/jspecify-gax-auth
nnicolee Jul 19, 2026
fba10fa
add JSpecify dependency to Bazel BUILD files
nnicolee Jul 19, 2026
d8ebf04
Merge branch 'feat/jspecify-gax-auth' of github.com:googleapis/google…
nnicolee Jul 19, 2026
c094849
Merge branch 'main' into feat/jspecify-gax-auth
nnicolee Jul 20, 2026
5e37306
revert: added back import mock for bigtable test
nnicolee Jul 20, 2026
bf8da72
Merge branch 'main' into feat/jspecify-gax-auth
nnicolee Jul 20, 2026
5b0dbec
revert: added back import for Answers for bigtable test
nnicolee Jul 20, 2026
81ce6d1
Merge branch 'main' into feat/jspecify-gax-auth
nnicolee Jul 20, 2026
619e82d
ran linting on java-bigtable test
nnicolee Jul 20, 2026
5f6018f
Merge branch 'main' into feat/jspecify-gax-auth
nnicolee Jul 20, 2026
144c2b3
chore: Downgrade jqwik to v1.8.2 as the last version compatibible wit…
lqiu96 Jul 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion java-storage/google-cloud-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
<dependency>
<groupId>net.jqwik</groupId>
<artifactId>jqwik</artifactId>
<version>1.9.3</version>
<version>1.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
1 change: 1 addition & 0 deletions sdk-platform-java/gax-java/gax-grpc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ _COMPILE_DEPS = [
"@com_google_guava_guava//jar",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_code_gson_gson//jar",
"@org_jspecify_jspecify//jar",
"@org_threeten_threetenbp//jar",
"@gapic_generator_java//google-auth-library-java/oauth2_http",
"@gapic_generator_java//google-auth-library-java/credentials",
Expand Down
4 changes: 4 additions & 0 deletions sdk-platform-java/gax-java/gax-grpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
</parent>

<dependencies>
<dependency>
<groupId>org.jspecify</groupId>
<artifactId>jspecify</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@

import com.google.api.gax.rpc.ApiStreamObserver;
import io.grpc.stub.StreamObserver;
import org.jspecify.annotations.NullMarked;

/**
* A delegate class that transfers calls to the ApiStreamObserver object.
*
* <p>Package-private for internal use.
*/
@NullMarked
class ApiStreamObserverDelegate<V> implements StreamObserver<V> {

private final ApiStreamObserver<V> delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
import io.grpc.Metadata.Key;
import java.util.Collections;
import java.util.Map;
import org.jspecify.annotations.NullMarked;

/** A utility class that provides helper functions to work with custom call options. */
@NullMarked
class CallOptionsUtil {
// this is a call option name, not a header name, it is not transferred over the wire
private static final CallOptions.Key<Map<Key<String>, String>> DYNAMIC_HEADERS_CALL_OPTION_KEY =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
import com.google.api.core.InternalApi;
import io.grpc.ManagedChannel;
import java.io.IOException;
import org.jspecify.annotations.NullMarked;

/**
* This interface represents a factory for creating one ManagedChannel
*
* <p>This is public only for technical reasons, for advanced usage.
*/
@NullMarked
@InternalApi("For internal use by google-cloud-java clients only")
public interface ChannelFactory {
ManagedChannel createSingleChannel() throws IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/**
* A {@link ManagedChannel} that will send requests round-robin via a set of channels.
Expand All @@ -68,6 +69,7 @@
*
* <p>Package-private for internal use.
*/
@NullMarked
class ChannelPool extends ManagedChannel {
static final String CHANNEL_POOL_CONSECUTIVE_RESIZING_WARNING =
"The gRPC ChannelPool used in the client has been flagged to be repeatedly resizing (5+ times). See https://github.com/googleapis/google-cloud-java/blob/main/docs/grpc_channel_pool_guide.md for more information about this behavior.";
Expand All @@ -78,8 +80,8 @@ class ChannelPool extends ManagedChannel {
private final ChannelFactory channelFactory;
private final FixedExecutorProvider backgroundExecutorProvider;

private ScheduledFuture<?> refreshFuture = null;
private ScheduledFuture<?> resizeFuture = null;
private @Nullable ScheduledFuture<?> refreshFuture = null;
private @Nullable ScheduledFuture<?> resizeFuture = null;

private final Object entryWriteLock = new Object();
@VisibleForTesting final AtomicReference<ImmutableList<Entry>> entries = new AtomicReference<>();
Expand Down Expand Up @@ -621,7 +623,7 @@ public <RequestT, ResponseT> ClientCall<RequestT, ResponseT> newCall(

/** ClientCall wrapper that makes sure to decrement the outstanding RPC count on completion. */
static class ReleasingClientCall<ReqT, RespT> extends SimpleForwardingClientCall<ReqT, RespT> {
@Nullable private CancellationException cancellationException;
private @Nullable CancellationException cancellationException;
final Entry entry;
private final AtomicBoolean wasClosed = new AtomicBoolean();
private final AtomicBoolean wasReleased = new AtomicBoolean();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.google.auto.value.AutoValue;
import com.google.common.base.Preconditions;
import java.time.Duration;
import org.jspecify.annotations.NullMarked;

/**
* Settings to control {@link ChannelPool} behavior.
Expand All @@ -52,6 +53,7 @@
*
* <p>The settings in this class will be applied every minute.
*/
@NullMarked
@BetaApi("surface for channel pool sizing is not yet stable")
@AutoValue
public abstract class ChannelPoolSettings {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@

import com.google.api.core.InternalApi;
import io.grpc.ManagedChannel;
import org.jspecify.annotations.NullMarked;

/**
* An interface to prepare a ManagedChannel for normal requests by priming the channel
*
* <p>This is public only for technical reasons, for advanced usage.
*/
@NullMarked
@InternalApi("For internal use by google-cloud-java clients only")
public interface ChannelPrimer {
void primeChannel(ManagedChannel managedChannel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@
import com.google.api.gax.rpc.StateCheckingResponseObserver;
import com.google.api.gax.rpc.StreamController;
import java.util.concurrent.CancellationException;
import org.jspecify.annotations.NullMarked;

/** Package-private for internal use. */
@NullMarked
class ExceptionResponseObserver<RequestT, ResponseT>
extends StateCheckingResponseObserver<ResponseT> {
private ResponseObserver<ResponseT> innerObserver;
private volatile CancellationException cancellationException;
private final GrpcApiExceptionFactory exceptionFactory;

public ExceptionResponseObserver(

Check warning on line 46 in sdk-platform-java/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/ExceptionResponseObserver.java

View check run for this annotation

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

"cancellationException" is marked "@NullMarked at class level" but is not initialized in this constructor.

See more on https://sonarcloud.io/project/issues?id=googleapis_google-cloud-java_showcase&issues=AZ-BqNfwvHH-bhId0d7m&open=AZ-BqNfwvHH-bhId0d7m&pullRequest=13840
ResponseObserver<ResponseT> innerObserver, GrpcApiExceptionFactory exceptionFactory) {
this.innerObserver = innerObserver;
this.exceptionFactory = exceptionFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
import com.google.api.gax.core.GaxProperties;
import io.grpc.Channel;
import java.util.regex.Pattern;
import org.jspecify.annotations.NullMarked;

/** Provides properties of the GAX-GRPC library. */
@NullMarked
@InternalApi
public class GaxGrpcProperties {
private static final String GAX_GRPC_VERSION =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@
import io.grpc.StatusException;
import io.grpc.StatusRuntimeException;
import java.util.Set;
import org.jspecify.annotations.NullMarked;

/**
* Core logic for transforming GRPC exceptions into {@link ApiException}s. This logic is shared
* amongst all the call types.
*
* <p>Package-private for internal use.
*/
@NullMarked
class GrpcApiExceptionFactory {

@VisibleForTesting static final String ERROR_DETAIL_KEY = "grpc-status-details-bin";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
import java.util.Objects;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/**
* GrpcCallContext encapsulates context data used to make a grpc call.
Expand All @@ -75,6 +76,7 @@
* #withTransportChannel}, return copies of the object, but with one field changed. The immutability
* and thread safety of the arguments solely depends on the arguments themselves.
*/
@NullMarked
@BetaApi("Reference ApiCallContext instead - this class is likely to experience breaking changes")
public final class GrpcCallContext implements ApiCallContext {
private static final GrpcStatusCode UNAUTHENTICATED_STATUS_CODE =
Expand All @@ -85,14 +87,14 @@
public static final CallOptions.Key<ApiTracer> TRACER_KEY = CallOptions.Key.create("gax.tracer");

private final Channel channel;
@Nullable private final Credentials credentials;
private final @Nullable Credentials credentials;
private final CallOptions callOptions;
@Nullable private final java.time.Duration timeout;
@Nullable private final java.time.Duration streamWaitTimeout;
@Nullable private final java.time.Duration streamIdleTimeout;
@Nullable private final Integer channelAffinity;
@Nullable private final RetrySettings retrySettings;
@Nullable private final ImmutableSet<StatusCode.Code> retryableCodes;
private final java.time.@Nullable Duration timeout;
private final java.time.@Nullable Duration streamWaitTimeout;
private final java.time.@Nullable Duration streamIdleTimeout;
private final @Nullable Integer channelAffinity;
private final @Nullable RetrySettings retrySettings;
private final @Nullable ImmutableSet<StatusCode.Code> retryableCodes;
private final ImmutableMap<String, List<String>> extraHeaders;
private final ApiCallContextOptions options;
private final EndpointContext endpointContext;
Expand Down Expand Up @@ -135,12 +137,12 @@
}

private GrpcCallContext(
Channel channel,
@Nullable Channel channel,
@Nullable Credentials credentials,
CallOptions callOptions,
@Nullable java.time.Duration timeout,
@Nullable java.time.Duration streamWaitTimeout,
@Nullable java.time.Duration streamIdleTimeout,
java.time.@Nullable Duration timeout,
java.time.@Nullable Duration streamWaitTimeout,
java.time.@Nullable Duration streamIdleTimeout,
@Nullable Integer channelAffinity,
ImmutableMap<String, List<String>> extraHeaders,
ApiCallContextOptions options,
Expand Down Expand Up @@ -257,12 +259,12 @@
/** This method is obsolete. Use {@link #withTimeoutDuration(java.time.Duration)} instead. */
@Override
@ObsoleteApi("Use withTimeoutDuration(java.time.Duration) instead")
public GrpcCallContext withTimeout(@Nullable org.threeten.bp.Duration timeout) {
public GrpcCallContext withTimeout(org.threeten.bp.@Nullable Duration timeout) {
return withTimeoutDuration(toJavaTimeDuration(timeout));
}

@Override
public GrpcCallContext withTimeoutDuration(@Nullable java.time.Duration timeout) {
public GrpcCallContext withTimeoutDuration(java.time.@Nullable Duration timeout) {
// Default RetrySettings use 0 for RPC timeout. Treat that as disabled timeouts.
if (timeout != null && (timeout.isZero() || timeout.isNegative())) {
timeout = null;
Expand All @@ -289,17 +291,14 @@
isDirectPath);
}

/** This method is obsolete. Use {@link #getTimeoutDuration()} instead. */
@Nullable
@Override
@ObsoleteApi("Use getTimeoutDuration() instead")
public org.threeten.bp.Duration getTimeout() {
public org.threeten.bp.@Nullable Duration getTimeout() {
return toThreetenDuration(getTimeoutDuration());
}

@Nullable
@Override
public java.time.Duration getTimeoutDuration() {
public java.time.@Nullable Duration getTimeoutDuration() {
return timeout;
}

Expand All @@ -310,13 +309,13 @@
@Override
@ObsoleteApi("Use withStreamWaitTimeoutDuration(java.time.Duration) instead")
public GrpcCallContext withStreamWaitTimeout(
@Nullable org.threeten.bp.Duration streamWaitTimeout) {
org.threeten.bp.@Nullable Duration streamWaitTimeout) {
return withStreamWaitTimeoutDuration(toJavaTimeDuration(streamWaitTimeout));
}

@Override
public GrpcCallContext withStreamWaitTimeoutDuration(
@Nullable java.time.Duration streamWaitTimeout) {
java.time.@Nullable Duration streamWaitTimeout) {
if (streamWaitTimeout != null) {
Preconditions.checkArgument(
streamWaitTimeout.compareTo(java.time.Duration.ZERO) >= 0, "Invalid timeout: < 0 s");
Expand Down Expand Up @@ -345,13 +344,13 @@
@Override
@ObsoleteApi("Use withStreamIdleTimeoutDuration(java.time.Duration) instead")
public GrpcCallContext withStreamIdleTimeout(
@Nullable org.threeten.bp.Duration streamIdleTimeout) {
org.threeten.bp.@Nullable Duration streamIdleTimeout) {
return withStreamIdleTimeoutDuration(toJavaTimeDuration(streamIdleTimeout));
}

@Override
public GrpcCallContext withStreamIdleTimeoutDuration(
@Nullable java.time.Duration streamIdleTimeout) {
java.time.@Nullable Duration streamIdleTimeout) {
if (streamIdleTimeout != null) {
Preconditions.checkArgument(
streamIdleTimeout.compareTo(java.time.Duration.ZERO) >= 0, "Invalid timeout: < 0 s");
Expand Down Expand Up @@ -573,9 +572,8 @@

/** This method is obsolete. Use {@link #getStreamWaitTimeoutDuration()} instead. */
@Override
@Nullable
@ObsoleteApi("Use getStreamWaitTimeoutDuration() instead")
public org.threeten.bp.Duration getStreamWaitTimeout() {
public org.threeten.bp.@Nullable Duration getStreamWaitTimeout() {
return toThreetenDuration(getStreamWaitTimeoutDuration());
}

Expand All @@ -585,17 +583,15 @@
* @see ApiCallContext#withStreamWaitTimeoutDuration(java.time.Duration)
*/
@Override
@Nullable
public java.time.Duration getStreamWaitTimeoutDuration() {
public java.time.@Nullable Duration getStreamWaitTimeoutDuration() {
return streamWaitTimeout;
}

/** This method is obsolete. Use {@link #getStreamIdleTimeoutDuration()} instead. */
@Override
@Nullable
@ObsoleteApi("Use getStreamIdleTimeoutDuration() instead")
public org.threeten.bp.Duration getStreamIdleTimeout() {
public org.threeten.bp.@Nullable Duration getStreamIdleTimeout() {
return toThreetenDuration(getStreamIdleTimeoutDuration());

Check warning on line 594 in sdk-platform-java/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcCallContext.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'toThreetenDuration' 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-BqNlEvHH-bhId0d7-&open=AZ-BqNlEvHH-bhId0d7-&pullRequest=13840
}

/**
Expand All @@ -604,14 +600,12 @@
* @see ApiCallContext#withStreamIdleTimeoutDuration(java.time.Duration)
*/
@Override
@Nullable
public java.time.Duration getStreamIdleTimeoutDuration() {
public java.time.@Nullable Duration getStreamIdleTimeoutDuration() {
return streamIdleTimeout;
}

/** The channel affinity for this context. */
@Nullable
public Integer getChannelAffinity() {
public @Nullable Integer getChannelAffinity() {
return channelAffinity;
}

Expand Down Expand Up @@ -769,7 +763,7 @@
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
import com.google.api.gax.rpc.RequestParamsExtractor;
import com.google.api.gax.rpc.ResourceNameExtractor;
import io.grpc.MethodDescriptor;
import org.jspecify.annotations.NullMarked;

/** Grpc-specific settings for creating callables. */
@NullMarked
public class GrpcCallSettings<RequestT, ResponseT> {
private final MethodDescriptor<RequestT, ResponseT> methodDescriptor;
private final RequestParamsExtractor<RequestT> paramsExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@
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. */
@NullMarked
public class GrpcCallableFactory {

private GrpcCallableFactory() {}
Expand All @@ -82,7 +84,7 @@
GrpcRawCallableFactory.createUnaryCallable(
grpcCallSettings, callSettings.getRetryableCodes());

if (grpcCallSettings.getRequestMutator() != null) {

Check warning on line 87 in sdk-platform-java/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcCallableFactory.java

View check run for this annotation

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

Change this condition so that it does not always evaluate to "true"

See more on https://sonarcloud.io/project/issues?id=googleapis_google-cloud-java_showcase&issues=AZ-BqNi4vHH-bhId0d75&open=AZ-BqNi4vHH-bhId0d75&pullRequest=13840
callable =
Callables.retrying(
callable, callSettings, clientContext, grpcCallSettings.getRequestMutator());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
import io.grpc.ClientInterceptor;
import io.grpc.MethodDescriptor;
import java.util.UUID;
import org.jspecify.annotations.NullMarked;

@NullMarked
class GrpcChannelUUIDInterceptor implements ClientInterceptor {
private final String uuid = UUID.randomUUID().toString();

Expand Down
Loading
Loading