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
5 changes: 0 additions & 5 deletions sdk-platform-java/gapic-generator-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,6 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
@AutoValue
public abstract class AnnotationNode implements AstNode {
public static AnnotationNode OVERRIDE =
Expand Down Expand Up @@ -138,9 +140,9 @@
List<Expr> exprList = descriptionExprs();
// avoid when single parameter is already set.
Preconditions.checkState(
exprList == null || exprList instanceof ArrayList,

Check warning on line 143 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/AnnotationNode.java

View check run for this annotation

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

Remove this expression which always evaluates to "false"

See more on https://sonarcloud.io/project/issues?id=googleapis_google-cloud-java_generator&issues=AZ9hB_BBvhlaxwr_h2B8&open=AZ9hB_BBvhlaxwr_h2B8&pullRequest=13769
MULTIPLE_AFTER_SINGLE_EXCEPTION_MESSAGE);
if (exprList == null) {

Check warning on line 145 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/AnnotationNode.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 "false"

See more on https://sonarcloud.io/project/issues?id=googleapis_google-cloud-java_generator&issues=AZ9hB_BBvhlaxwr_h2B7&open=AZ9hB_BBvhlaxwr_h2B7&pullRequest=13769
exprList = new ArrayList<>();
}
exprList.add(expr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
@AutoValue
public abstract class ClassDefinition implements AstNode {
// Optional.
Expand Down Expand Up @@ -169,7 +171,7 @@
// Check abstract extended type.
if (classDef.extendsType() != null) {
Preconditions.checkState(
TypeNode.isReferenceType(classDef.extendsType()),

Check warning on line 174 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/ClassDefinition.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'isReferenceType' 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_generator&issues=AZ9hB_B6vhlaxwr_h2B9&open=AZ9hB_B6vhlaxwr_h2B9&pullRequest=13769
"Classes cannot extend non-reference types");
Preconditions.checkState(
!classDef.implementsTypes().contains(classDef.extendsType()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
@AutoValue
public abstract class ConcreteReference implements Reference {
private static final String EXTENDS = "extends";
Expand Down Expand Up @@ -99,7 +101,7 @@
public abstract boolean useFullName();

@Override
public ImmutableList<String> enclosingClassNames() {

Check failure on line 104 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/ConcreteReference.java

View check run for this annotation

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

Fix the incompatibility of the annotation @Nullable to honor @NullMarked at class level of the overridden method.

See more on https://sonarcloud.io/project/issues?id=googleapis_google-cloud-java_generator&issues=AZ9hB_CKvhlaxwr_h2B_&open=AZ9hB_CKvhlaxwr_h2B_&pullRequest=13769
if (!hasEnclosingClass()) {
return ImmutableList.of();
}
Expand Down Expand Up @@ -152,7 +154,7 @@
@Override
public boolean isAssignableFrom(Reference other) {
if (other instanceof VaporReference && ((VaporReference) other).supertypeReference() != null) {
return isAssignableFrom(((VaporReference) other).supertypeReference());

Check warning on line 157 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/ConcreteReference.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'isAssignableFrom' 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_generator&issues=AZ9hB_CKvhlaxwr_h2B-&open=AZ9hB_CKvhlaxwr_h2B-&pullRequest=13769
}

if (!(other instanceof ConcreteReference)) {
Expand All @@ -176,7 +178,7 @@
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof ConcreteReference)) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
@AutoValue
public abstract class JavaDocComment implements Comment {
@Override
Expand All @@ -48,11 +51,11 @@ public abstract static class Builder {
static final String PARAM_INDENT = " ";

// The lack of a getter for these local variables in the external class is WAI.
String throwsType = null;
String throwsDescription = null;
String deprecated = null;
String internalOnly = null;
String returnDescription = null;
@Nullable String throwsType = null;
@Nullable String throwsDescription = null;
@Nullable String deprecated = null;
@Nullable String internalOnly = null;
@Nullable String returnDescription = null;
List<String> paramsList = new ArrayList<>();
List<String> componentsList = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
@AutoValue
public abstract class MethodDefinition implements AstNode {
static final Reference RUNTIME_EXCEPTION_REFERENCE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
@AutoValue
public abstract class MethodInvocationExpr implements Expr {
public abstract IdentifierNode methodIdentifier();
Expand Down Expand Up @@ -103,7 +105,7 @@

if (methodInvocationExpr.staticReferenceType() != null) {
Preconditions.checkState(
TypeNode.isReferenceType(methodInvocationExpr.staticReferenceType()),

Check warning on line 108 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/MethodInvocationExpr.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'isReferenceType' 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_generator&issues=AZ9hB_Dgvhlaxwr_h2CD&open=AZ9hB_Dgvhlaxwr_h2CD&pullRequest=13769
"Static references can only be made on object types");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

import com.google.common.collect.ImmutableList;
import java.util.List;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public interface Reference extends AstNode {
@Override
void accept(AstNodeVisitor visitor);
Expand All @@ -38,11 +40,9 @@ public interface Reference extends AstNode {
// The nested types in left-to-right order, if any.
// Example: com.google.Foo.Bar.Car.ThisType will have the outer types listed in the order
// [Foo, Bar, Car].
@Nullable
ImmutableList<String> enclosingClassNames();
@Nullable ImmutableList<String> enclosingClassNames();

@Nullable
Reference wildcardUpperBound();
@Nullable Reference wildcardUpperBound();

Reference copyAndSetGenerics(List<Reference> generics);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

package com.google.api.generator.engine.ast;

import org.jspecify.annotations.Nullable;

public class ScopeNode implements AstNode {
private enum ScopeKind {
LOCAL, // Placeholder for local scopes.
Expand Down Expand Up @@ -54,7 +56,7 @@ public void accept(AstNodeVisitor visitor) {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof ScopeNode)) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

import com.google.auto.value.AutoValue;
import com.google.common.base.Preconditions;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
@AutoValue
public abstract class ThrowExpr implements Expr {
// TODO(miraleung): Refactor with StringObjectValue and possibly with NewObjectExpr.
Expand Down Expand Up @@ -70,10 +72,10 @@
abstract ThrowExpr autoBuild();

public ThrowExpr build() {
if (throwExpr() != null) {

Check warning on line 75 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/ThrowExpr.java

View check run for this annotation

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

Remove this expression which always evaluates to "true"

See more on https://sonarcloud.io/project/issues?id=googleapis_google-cloud-java_generator&issues=AZ9hB_CXvhlaxwr_h2CA&open=AZ9hB_CXvhlaxwr_h2CA&pullRequest=13769
setType(throwExpr().type());
Preconditions.checkState(
messageExpr() == null && causeExpr() == null,

Check warning on line 78 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/ThrowExpr.java

View check run for this annotation

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

Remove this expression which always evaluates to "false"

See more on https://sonarcloud.io/project/issues?id=googleapis_google-cloud-java_generator&issues=AZ9hB_CXvhlaxwr_h2CB&open=AZ9hB_CXvhlaxwr_h2CB&pullRequest=13769
"Only one of throwExpr or [messageExpr or causeExpr, inclusive] can be present.");

if (throwExpr() instanceof VariableExpr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
@AutoValue
public abstract class TryCatchStatement implements Statement {

Expand Down Expand Up @@ -61,7 +62,7 @@ public abstract static class Builder {

public abstract Builder setIsSampleCode(boolean isSampleCode);

public Builder addCatch(@Nonnull VariableExpr variableExpr, List<Statement> body) {
public Builder addCatch(VariableExpr variableExpr, List<Statement> body) {
List<VariableExpr> catchVarExprs = new ArrayList<>(catchVariableExprs());
catchVarExprs.add(variableExpr);
setCatchVariableExprs(catchVarExprs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
@AutoValue
public abstract class TypeNode implements AstNode, Comparable<TypeNode> {
static final Reference EXCEPTION_REFERENCE = ConcreteReference.withClazz(Exception.class);
Expand Down Expand Up @@ -115,7 +117,7 @@
public static TypeNode createArrayTypeOf(TypeNode type) {
return builder()
.setTypeKind(type.typeKind())
.setReference(type.reference())

Check warning on line 120 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/TypeNode.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'setReference' 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_generator&issues=AZ9hB-9fvhlaxwr_h2B3&open=AZ9hB-9fvhlaxwr_h2B3&pullRequest=13769
.setIsArray(true)
.build();
}
Expand All @@ -124,7 +126,7 @@
Preconditions.checkArgument(type.isArray(), "Input type must be an array");
return builder()
.setTypeKind(type.typeKind())
.setReference(type.reference())

Check warning on line 129 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/TypeNode.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'setReference' 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_generator&issues=AZ9hB-9fvhlaxwr_h2B5&open=AZ9hB-9fvhlaxwr_h2B5&pullRequest=13769
.setIsArray(false)
.build();
}
Expand Down Expand Up @@ -175,7 +177,7 @@
abstract TypeNode autoBuild();

public TypeNode build() {
if (reference() != null) {

Check warning on line 180 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/TypeNode.java

View check run for this annotation

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

Remove this expression which always evaluates to "true"

See more on https://sonarcloud.io/project/issues?id=googleapis_google-cloud-java_generator&issues=AZ9hB-9fvhlaxwr_h2B2&open=AZ9hB-9fvhlaxwr_h2B2&pullRequest=13769
// Disallow top-level wildcard references.
Preconditions.checkState(
!reference().isWildcard(),
Expand All @@ -198,7 +200,7 @@
}

public static boolean isExceptionType(TypeNode type) {
return isReferenceType(type) && EXCEPTION_REFERENCE.isAssignableFrom(type.reference());

Check warning on line 203 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/TypeNode.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'isAssignableFrom' 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_generator&issues=AZ9hB-9fvhlaxwr_h2B4&open=AZ9hB-9fvhlaxwr_h2B4&pullRequest=13769
}

public static boolean isReferenceType(TypeNode type) {
Expand Down Expand Up @@ -244,7 +246,7 @@
return !isPrimitiveType()
&& !other.isPrimitiveType()
&& isArray() == other.isArray()
&& (reference().isSupertypeOrEquals(other.reference()) || oneTypeIsNull);

Check warning on line 249 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/TypeNode.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'isSupertypeOrEquals' 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_generator&issues=AZ9hB-9fvhlaxwr_h2B6&open=AZ9hB-9fvhlaxwr_h2B6&pullRequest=13769
}

@Override
Expand All @@ -254,7 +256,7 @@

// Java overrides.
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof TypeNode)) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
@AutoValue
public abstract class VaporReference implements Reference {
private static final String DOT = ".";
Expand Down Expand Up @@ -51,7 +53,7 @@

@Nullable
@Override
public abstract ImmutableList<String> enclosingClassNames();

Check failure on line 56 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/VaporReference.java

View check run for this annotation

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

Fix the incompatibility of the annotation @Nullable to honor @NullMarked at class level of the overridden method.

See more on https://sonarcloud.io/project/issues?id=googleapis_google-cloud-java_generator&issues=AZ9hB_Covhlaxwr_h2CC&open=AZ9hB_Covhlaxwr_h2CC&pullRequest=13769

@Nullable
public abstract Reference supertypeReference();
Expand Down Expand Up @@ -109,7 +111,7 @@
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof VaporReference)) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
@AutoValue
public abstract class VariableExpr implements Expr {
public abstract Variable variable();
Expand Down Expand Up @@ -174,7 +176,7 @@
}
if (variableExpr.staticReferenceType() != null) {
Preconditions.checkState(
TypeNode.isReferenceType(variableExpr.staticReferenceType()),

Check warning on line 179 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/ast/VariableExpr.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'isReferenceType' 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_generator&issues=AZ9hB_Dwvhlaxwr_h2CE&open=AZ9hB_Dwvhlaxwr_h2CE&pullRequest=13769
String.format(
"Static field references can only be done on static types, but instead found %s",
variableExpr.staticReferenceType()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public class ImportWriterVisitor implements AstNodeVisitor {
private static final String DOT = ".";
private static final String PKG_JAVA_LANG = "java.lang";
Expand All @@ -91,12 +92,12 @@
importShortNames.clear();
}

public void initialize(@Nonnull String currentPackage) {
public void initialize(String currentPackage) {
this.currentPackage = currentPackage;
currentClassName = null;
}

public void initialize(@Nonnull String currentPackage, @Nonnull String currentClassName) {
public void initialize(String currentPackage, String currentClassName) {
this.currentPackage = currentPackage;
this.currentClassName = currentClassName;
}
Expand Down Expand Up @@ -167,7 +168,7 @@
public void visit(AnnotationNode annotation) {
annotation.type().accept(this);
if (annotation.descriptionExprs() != null) {
expressions(annotation.descriptionExprs());

Check warning on line 171 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/engine/writer/ImportWriterVisitor.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'expressions' 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_generator&issues=AZ9hB_EEvhlaxwr_h2CF&open=AZ9hB_EEvhlaxwr_h2CF&pullRequest=13769
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
import com.google.common.base.Strings;
import java.util.logging.Logger;
import javax.annotation.Generated;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public class ClientLibraryPackageInfoComposer {

private static final Logger LOGGER =
Expand All @@ -47,7 +50,7 @@ public class ClientLibraryPackageInfoComposer {
private static final String SAMPLE_CODE_HEADER_PATTERN = "Sample for %s:";
private static final String SERVICE_DESCRIPTION_HEADER_PATTERN = "Service Description: %s";

public static GapicPackageInfo generatePackageInfo(GapicContext context) {
public static @Nullable GapicPackageInfo generatePackageInfo(GapicContext context) {
if (!context.containsServices()) {
LOGGER.warning("Generating empty package info since no services were found");
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public class Composer {
public static List<GapicClass> composeServiceClasses(GapicContext context) {
List<GapicClass> clazzes = new ArrayList<>();
Expand All @@ -53,11 +56,11 @@
return addApacheLicense(prepareExecutableSamples(clazzes));
}

public static GapicPackageInfo composePackageInfo(GapicContext context) {
public static @Nullable GapicPackageInfo composePackageInfo(GapicContext context) {
if (!context.containsServices()) {
return null;
}
return addApacheLicense(ClientLibraryPackageInfoComposer.generatePackageInfo(context));

Check warning on line 63 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/Composer.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'addApacheLicense' 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_generator&issues=AZ9hB_Onvhlaxwr_h2CN&open=AZ9hB_Onvhlaxwr_h2CN&pullRequest=13769
}

public static List<ReflectConfig> composeNativeReflectConfig(GapicContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.jspecify.annotations.Nullable;

public class ServiceClientCommentComposer {
// Tokens.
Expand Down Expand Up @@ -103,7 +104,7 @@
String classMethodSampleCode,
String credentialsSampleCode,
String endpointSampleCode,
String transportSampleCode,
@Nullable String transportSampleCode,
String primaryTransport,
String secondaryTransport) {
JavaDocComment.Builder classHeaderJavadocBuilder = JavaDocComment.builder();
Expand Down Expand Up @@ -198,7 +199,7 @@
// TODO(miraleung): Remove the newline replacement when we support CommonMark.
String description =
argument.field().hasDescription() ? argument.field().description() : EMPTY_STRING;
methodJavadocBuilder.addParam(JavaStyle.toLowerCamelCase(argument.name()), description);

Check warning on line 202 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/comment/ServiceClientCommentComposer.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'addParam' 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_generator&issues=AZ9heyLnOoEpLNhm1Tqc&open=AZ9heyLnOoEpLNhm1Tqc&pullRequest=13769
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

public abstract class AbstractServiceStubClassComposer implements ClassComposer {

Expand Down Expand Up @@ -214,7 +215,7 @@ private MethodDefinition createCallableGetterHelper(
}

private List<MethodDefinition> createOperationsStubGetters(
TypeStore typeStore, TypeNode operationsStubType) {
TypeStore typeStore, @Nullable TypeNode operationsStubType) {
List<MethodDefinition> getters = new ArrayList<>();

Iterator<String> operationStubNameIt =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

public abstract class AbstractServiceStubSettingsClassComposer implements ClassComposer {
private static final Statement EMPTY_LINE_STATEMENT = EmptyLineStatement.create();
Expand Down Expand Up @@ -774,7 +774,7 @@
.setMethodName("set" + JavaStyle.toUpperCamelCase(method.pageSizeFieldName()))
.setArguments(
MethodInvocationExpr.builder()
.setStaticReferenceType(

Check warning on line 777 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'setStaticReferenceType' 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_generator&issues=AZ9hB_G4vhlaxwr_h2CH&open=AZ9hB_G4vhlaxwr_h2CH&pullRequest=13769
BIGQUERY_PAGINATE_MAX_RESULT_TYPES.get(methodFullName))
.setMethodName("of")
.setArguments(pageSizeVarExpr)
Expand Down Expand Up @@ -1899,8 +1899,8 @@
protected MethodDefinition createNestedClassCreateDefaultMethod(
TypeStore typeStore,
String methodName,
String defaultTransportChannelProvider,
String defaultTransportChannelProviderBuilder,
@Nullable String defaultTransportChannelProvider,
@Nullable String defaultTransportChannelProviderBuilder,
String defaultApiClientHeaderProviderBuilder) {
List<Statement> bodyStatements = new ArrayList<>();

Expand Down Expand Up @@ -1946,7 +1946,7 @@
MethodInvocationExpr.builder()
.setExprReferenceExpr(
MethodInvocationExpr.builder()
.setMethodName(defaultTransportChannelProviderBuilder)

Check warning on line 1949 in sdk-platform-java/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java

View check run for this annotation

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

Annotate the parameter with @javax.annotation.Nullable in method 'setMethodName' 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_generator&issues=AZ9hB_G4vhlaxwr_h2CI&open=AZ9hB_G4vhlaxwr_h2CI&pullRequest=13769
.build())
.setMethodName("build")
.build())
Expand Down
Loading
Loading