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:04 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 0b99bea59 -> 20e957c9b


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


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

Branch: refs/heads/trunk
Commit: 20e957c9b1f389621bb8ae9e9f5554b66cd92a4f
Parents: 0b99bea
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:01 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/20e957c9/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/20e957c9/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