Skip to content

Commit a65626b

Browse files
authored
MINOR: Add functionalinterface to the producer callback (#19366)
The Callback interface is a perfect example of a place that can use the functionalinterface in Java. Strictly for Java, this isn't "required" since Java will automatically coerce, but for Clojure (and other JVM languages I belive) to interop with Java lambdas it needs the FunctionalInterface annotation. Since FunctionalInterface doesn't add any overhead and provides compiler-enforced documentation, I don't see any reason *not* to have this. This has already been added into Kafka Streams here: #19234 (review) I am happy to add it to any other spots in that might be useful too. Reviewers: Chia-Ping Tsai <[email protected]>
1 parent 9f676dd commit a65626b

File tree

2 files changed

+2
-0
lines changed
  • clients/src/main/java/org/apache/kafka/clients/producer
  • connect/runtime/src/main/java/org/apache/kafka/connect/util

2 files changed

+2
-0
lines changed

Diff for: clients/src/main/java/org/apache/kafka/clients/producer/Callback.java

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* A callback interface that the user can implement to allow code to execute when the request is complete. This callback
2121
* will generally execute in the background I/O thread so it should be fast.
2222
*/
23+
@FunctionalInterface
2324
public interface Callback {
2425

2526
/**

Diff for: connect/runtime/src/main/java/org/apache/kafka/connect/util/Callback.java

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
/**
2020
* Generic interface for callbacks
2121
*/
22+
@FunctionalInterface
2223
public interface Callback<V> {
2324
/**
2425
* Invoked upon completion of the operation.

0 commit comments

Comments
 (0)