kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: KAFKA-4672; fix source compatibility for lambda expressions
Date Sat, 21 Jan 2017 22:10:11 GMT
Repository: kafka
Updated Branches:
  refs/heads/0.10.2 db57c1a0c -> e393c9928


KAFKA-4672; fix source compatibility for lambda expressions

Variance changes introduced in KIP-100 cause compilation failures with lambda expression in
Java 8. To my knowledge this only affects the following method

`KStreams.transform(TransformerSupplier<...>, String...)`

prior to the changes it was possible to write:

`streams.transform(MyTransformer::new)`

where `MyTransformer` extends `Transformer`

After the changes the Java compiler is unable to infer correct return types for the lambda
expressions. This change fixed this by reverting to invariant return types for transformer
suppliers.

please cherry-pick into 0.10.2.x

Author: Xavier Léauté <xavier@confluent.io>

Reviewers: Ismael Juma, Damian Guy, Guozhang Wang

Closes #2402 from xvrl/lambdas-oh-my

(cherry picked from commit 20e957c9b1f389621bb8ae9e9f5554b66cd92a4f)
Signed-off-by: Guozhang Wang <wangguoz@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/e393c992
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/e393c992
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/e393c992

Branch: refs/heads/0.10.2
Commit: e393c9928972c00677250ae2df3b4f061fdccd58
Parents: db57c1a
Author: Xavier Léauté <xavier@confluent.io>
Authored: Sat Jan 21 14:10:01 2017 -0800
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Sat Jan 21 14:10:08 2017 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/kafka/streams/kstream/KStream.java    | 2 +-
 .../org/apache/kafka/streams/kstream/internals/KStreamImpl.java    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/e393c992/streams/src/main/java/org/apache/kafka/streams/kstream/KStream.java
----------------------------------------------------------------------
diff --git a/streams/src/main/java/org/apache/kafka/streams/kstream/KStream.java b/streams/src/main/java/org/apache/kafka/streams/kstream/KStream.java
index 3e95e7c..3509523 100644
--- a/streams/src/main/java/org/apache/kafka/streams/kstream/KStream.java
+++ b/streams/src/main/java/org/apache/kafka/streams/kstream/KStream.java
@@ -623,7 +623,7 @@ public interface KStream<K, V> {
      * @see #transformValues(ValueTransformerSupplier, String...)
      * @see #process(ProcessorSupplier, String...)
      */
-    <K1, V1> KStream<K1, V1> transform(final TransformerSupplier<? super K,
? super V, ? extends KeyValue<? extends K1, ? extends V1>> transformerSupplier,
+    <K1, V1> KStream<K1, V1> transform(final TransformerSupplier<? super K,
? super V, KeyValue<K1, V1>> transformerSupplier,
                                        final String... stateStoreNames);
 
     /**

http://git-wip-us.apache.org/repos/asf/kafka/blob/e393c992/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamImpl.java
----------------------------------------------------------------------
diff --git a/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamImpl.java
b/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamImpl.java
index b99e55d..3d41ae4 100644
--- a/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamImpl.java
+++ b/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamImpl.java
@@ -365,7 +365,7 @@ public class KStreamImpl<K, V> extends AbstractStream<K> implements
KStream<K, V
     }
 
     @Override
-    public <K1, V1> KStream<K1, V1> transform(TransformerSupplier<? super
K, ? super V, ? extends KeyValue<? extends K1, ? extends V1>> transformerSupplier,
String... stateStoreNames) {
+    public <K1, V1> KStream<K1, V1> transform(TransformerSupplier<? super
K, ? super V, KeyValue<K1, V1>> transformerSupplier, String... stateStoreNames) {
         Objects.requireNonNull(transformerSupplier, "transformerSupplier can't be null");
         String name = topology.newName(TRANSFORM_NAME);
 


Mime
View raw message