Skip to content

Commit 2797feb

Browse files
author
Pritham Marupaka
committed
Add @CheckReturnValue annotation to api methods that return results
1 parent c910814 commit 2797feb

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

conjure-java-core/src/integrationInput/java/com/palantir/product/ErrorServiceAsync.java

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

conjure-java-core/src/integrationInput/java/com/palantir/product/ErrorServiceBlocking.java

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

conjure-java-core/src/main/java/com/palantir/conjure/java/services/dialogue/DialogueInterfaceGenerator.java

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.fasterxml.jackson.annotation.JsonValue;
2424
import com.google.common.base.CaseFormat;
2525
import com.google.common.util.concurrent.ListenableFuture;
26+
import com.google.errorprone.annotations.CheckReturnValue;
2627
import com.google.errorprone.annotations.MustBeClosed;
2728
import com.palantir.conjure.java.ConjureAnnotations;
2829
import com.palantir.conjure.java.Options;
@@ -387,6 +388,8 @@ private MethodSpec apiMethod(
387388
ErrorGenerationUtils.endpointResponseResultTypeName(endpointDef.getEndpointName()));
388389
methodBuilder.returns(serviceCallType.switchBy(
389390
returnType, ParameterizedTypeName.get(ClassName.get(ListenableFuture.class), returnType)));
391+
// The result type should be used by clients
392+
methodBuilder.addAnnotation(CheckReturnValue.class);
390393
} else {
391394
TypeName returnType = serviceCallType.switchBy(
392395
returnTypes.baseType(endpointDef.getReturns()), returnTypes.async(endpointDef.getReturns()));

0 commit comments

Comments
 (0)