[ 
https://issues.apache.org/jira/browse/KAFKA-4672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xavier Léauté updated KAFKA-4672:
---------------------------------
    Description: 
Variance changes introduced in KIP-100 cause compilation failures with lambda 
expression in Java 8.

To my knowledge this only affects methods taking suppliers of functions
KStreams.transform(TransformerSupplier<...>, String...)
KStreams.transformValues(ValueTransformerSupplier<...>)

prior to the changes it was possible to write

streams.transform(MyTransformer::new)
streams.transformValues(MyValueTransformer::new)

where MyTransformer and MyValueTransformer extend Transformer and 
ValueTransformer respectively.

After the changes the Java compiler is unable to infer correct return types for 
the lambda expression.

  was:
Variance changes introduced in KIP-100 cause compilation failures with lambda 
expression in Java 8.

To my knowledge this only affects methods taking suppliers of functions
KStreams.transform(TransformerSupplier<...>, String...)
KStreams.transformValues(ValueTransformerSupplier<...>)
KStreams.process(ProcessorSupplier<...>)

prior to the changes it was possible to write

streams.process(MyProcessor::new)
streams.transform(MyTransformer::new)
etc.

where MyProcessor and MyTransformer extend Processor and Transformer 
respectively.

After the changes the Java compiler is unable to infer correct types for the 
lambda expression.


> KIP-100 api changes break Java 8 lambda expressions in some cases 
> ------------------------------------------------------------------
>
>                 Key: KAFKA-4672
>                 URL: https://issues.apache.org/jira/browse/KAFKA-4672
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>    Affects Versions: 0.10.2.0
>            Reporter: Xavier Léauté
>            Assignee: Xavier Léauté
>             Fix For: 0.10.2.0
>
>
> Variance changes introduced in KIP-100 cause compilation failures with lambda 
> expression in Java 8.
> To my knowledge this only affects methods taking suppliers of functions
> KStreams.transform(TransformerSupplier<...>, String...)
> KStreams.transformValues(ValueTransformerSupplier<...>)
> prior to the changes it was possible to write
> streams.transform(MyTransformer::new)
> streams.transformValues(MyValueTransformer::new)
> where MyTransformer and MyValueTransformer extend Transformer and 
> ValueTransformer respectively.
> After the changes the Java compiler is unable to infer correct return types 
> for the lambda expression.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to