diff --git a/api-common-java/src/main/java/com/google/api/core/ApiAsyncFunction.java b/api-common-java/src/main/java/com/google/api/core/ApiAsyncFunction.java
index deb8d48e35..cb0c8b2cb0 100644
--- a/api-common-java/src/main/java/com/google/api/core/ApiAsyncFunction.java
+++ b/api-common-java/src/main/java/com/google/api/core/ApiAsyncFunction.java
@@ -34,6 +34,7 @@
*
*
It is similar to Guava's {@code AsyncFunction}, redeclared so that Guava can be shaded.
*/
+@FunctionalInterface
public interface ApiAsyncFunction {
/**
* Returns an output Future to use in place of the given input. The output Future need not be
diff --git a/api-common-java/src/main/java/com/google/api/core/ApiFunction.java b/api-common-java/src/main/java/com/google/api/core/ApiFunction.java
index d03d934930..ca5dfb1806 100644
--- a/api-common-java/src/main/java/com/google/api/core/ApiFunction.java
+++ b/api-common-java/src/main/java/com/google/api/core/ApiFunction.java
@@ -34,6 +34,7 @@
*
*
It is similar to Guava's {@code Function}, redeclared so that Guava can be shaded.
*/
+@FunctionalInterface
public interface ApiFunction {
T apply(F input);
}
diff --git a/api-common-java/src/main/java/com/google/api/pathtemplate/ValidationException.java b/api-common-java/src/main/java/com/google/api/pathtemplate/ValidationException.java
index 3efa388f5d..2d778c5e95 100644
--- a/api-common-java/src/main/java/com/google/api/pathtemplate/ValidationException.java
+++ b/api-common-java/src/main/java/com/google/api/pathtemplate/ValidationException.java
@@ -39,6 +39,7 @@
*/
public class ValidationException extends IllegalArgumentException {
+ @FunctionalInterface
public interface Supplier {
T get();
}
diff --git a/gax-java/gax-httpjson/src/main/java/com/google/api/gax/httpjson/FieldsExtractor.java b/gax-java/gax-httpjson/src/main/java/com/google/api/gax/httpjson/FieldsExtractor.java
index 024e8d3d1e..aa42604596 100644
--- a/gax-java/gax-httpjson/src/main/java/com/google/api/gax/httpjson/FieldsExtractor.java
+++ b/gax-java/gax-httpjson/src/main/java/com/google/api/gax/httpjson/FieldsExtractor.java
@@ -33,6 +33,7 @@
* A functional interface to be implemented for each request message to extract specific fields from
* it. For advanced usage only.
*/
+@FunctionalInterface
public interface FieldsExtractor {
ParamsT extract(RequestT request);
}
diff --git a/gax-java/gax/src/main/java/com/google/api/gax/rpc/BidiStreamingCallable.java b/gax-java/gax/src/main/java/com/google/api/gax/rpc/BidiStreamingCallable.java
index c973675881..38efb2da37 100644
--- a/gax-java/gax/src/main/java/com/google/api/gax/rpc/BidiStreamingCallable.java
+++ b/gax-java/gax/src/main/java/com/google/api/gax/rpc/BidiStreamingCallable.java
@@ -100,15 +100,7 @@ public void call(final BidiStreamObserver bidiObserver) {
/** Listens to server responses and send requests when the network is free. */
public void call(
final BidiStreamObserver bidiObserver, ApiCallContext context) {
- internalCall(
- bidiObserver,
- new ClientStreamReadyObserver() {
- @Override
- public void onReady(ClientStream stream) {
- bidiObserver.onReady(stream);
- }
- },
- context);
+ internalCall(bidiObserver, bidiObserver, context);
}
/**
@@ -183,11 +175,8 @@ public ClientStream splitCall(
ResponseObserver responseObserver, ApiCallContext context) {
return internalCall(
responseObserver,
- new ClientStreamReadyObserver() {
- @Override
- public void onReady(ClientStream stream) {
- // no op
- }
+ stream -> {
+ // no op
},
context);
}
diff --git a/gax-java/gax/src/main/java/com/google/api/gax/rpc/ClientStreamReadyObserver.java b/gax-java/gax/src/main/java/com/google/api/gax/rpc/ClientStreamReadyObserver.java
index 0347524512..d0c9f32d5b 100644
--- a/gax-java/gax/src/main/java/com/google/api/gax/rpc/ClientStreamReadyObserver.java
+++ b/gax-java/gax/src/main/java/com/google/api/gax/rpc/ClientStreamReadyObserver.java
@@ -30,6 +30,7 @@
package com.google.api.gax.rpc;
/** A callback used to report that the {@link ClientStream} is ready to send more messages. */
+@FunctionalInterface
public interface ClientStreamReadyObserver {
void onReady(ClientStream stream);
}