Skip to content

KAFKA-4672 fix source compatibility for lambda expressions#2402

Closed
xvrl wants to merge 1 commit intoapache:trunkfrom
xvrl:lambdas-oh-my
Closed

KAFKA-4672 fix source compatibility for lambda expressions#2402
xvrl wants to merge 1 commit intoapache:trunkfrom
xvrl:lambdas-oh-my

Conversation

@xvrl
Copy link
Copy Markdown
Member

@xvrl xvrl commented Jan 18, 2017

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

@enothereska
Copy link
Copy Markdown
Contributor

cc'ing @ijuma

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 18, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/998/
Test FAILed (JDK 8 and Scala 2.11).

@xvrl
Copy link
Copy Markdown
Member Author

xvrl commented Jan 18, 2017

retest this please

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 18, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/996/
Test PASSed (JDK 8 and Scala 2.12).

@ijuma
Copy link
Copy Markdown
Member

ijuma commented Jan 18, 2017

It would be good to explain the reasoning in the PR description for posterity.

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 18, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/996/
Test FAILed (JDK 7 and Scala 2.10).

@xvrl
Copy link
Copy Markdown
Member Author

xvrl commented Jan 19, 2017

retest this please

@xvrl
Copy link
Copy Markdown
Member Author

xvrl commented Jan 19, 2017

@ijuma updated pr description

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1006/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1004/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1004/
Test PASSed (JDK 7 and Scala 2.10).

@enothereska
Copy link
Copy Markdown
Contributor

cc'ing @dguy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this one needs to change. AFAICT it is only transform that has the issue

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are correct, fixed

@enothereska
Copy link
Copy Markdown
Contributor

I think one issue is that we don't have tests for Java 8 handy.

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1026/
Test FAILed (JDK 7 and Scala 2.10).

Copy link
Copy Markdown
Contributor

@dguy dguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1028/
Test PASSed (JDK 8 and Scala 2.11).

@xvrl
Copy link
Copy Markdown
Member Author

xvrl commented Jan 19, 2017

retest this please

@enothereska
Copy link
Copy Markdown
Contributor

Ok, LGTM. Thanks!

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1031/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1029/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1026/
Test FAILed (JDK 8 and Scala 2.12).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1029/
Test PASSed (JDK 7 and Scala 2.10).

@xvrl
Copy link
Copy Markdown
Member Author

xvrl commented Jan 19, 2017

retest this please

Copy link
Copy Markdown
Member

@ijuma ijuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, assuming that someone has verified that this fixes the issue mentioned in the PR.

We should look into including Java 8 tests/examples in the codebase in the future.

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1035/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1037/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1035/
Test FAILed (JDK 7 and Scala 2.10).

@xvrl
Copy link
Copy Markdown
Member Author

xvrl commented Jan 19, 2017

retest this please

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1039/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1041/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1039/
Test PASSed (JDK 7 and Scala 2.10).

asfgit pushed a commit that referenced this pull request Jan 21, 2017
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 20e957c)
Signed-off-by: Guozhang Wang <wangguoz@gmail.com>
@guozhangwang
Copy link
Copy Markdown
Contributor

LGTM, merged to trunk and 0.10.2.

Thanks @xvrl !

@asfgit asfgit closed this in 20e957c Jan 21, 2017
soenkeliebau pushed a commit to soenkeliebau/kafka that referenced this pull request Feb 7, 2017
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 apache#2402 from xvrl/lambdas-oh-my
@xvrl xvrl deleted the lambdas-oh-my branch April 17, 2017 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants