gpt4 book ai didi

java - 关于 lambda 的 Cassandra 编译问题

转载 作者:行者123 更新时间:2023-11-30 08:09:31 25 4
gpt4 key购买 nike

Cassandra 源代码是最新的,它是从 git@github.com:apache/cassandra.git 克隆而来的。

JDK 版本为 1.8.0_05

操作系统:Linux 3.13.0-62-generic#102-Ubuntu SMP

[javac] **/cassandra/test/burn/org/apache/cassandra/utils/LongBTreeTest.java:83: error: reference to testRandomSelection is ambiguous
[javac] testRandomSelection(perThreadTrees, perTreeSelections,
[javac] ^
[javac] both method testRandomSelection(int,int,BTreeTestFactory) in LongBTreeTest and method testRandomSelection(int,int,Consumer<RandomSelection>) in LongBTreeTest match
[javac] **/cassandra/test/burn/org/apache/cassandra/utils/LongBTreeTest.java:157: error: reference to testRandomSelection is ambiguous
[javac] testRandomSelection(perThreadTrees, 4,
[javac] ^
[javac] both method testRandomSelection(int,int,BTreeTestFactory) in LongBTreeTest and method testRandomSelection(int,int,Consumer<RandomSelection>) in LongBTreeTest match
[javac] **/cassandra/test/burn/org/apache/cassandra/utils/LongBTreeTest.java:158: error: incompatible types: bad return type in lambda expression
[javac] (selection) ->
[javac] ^
[javac] missing return value
[javac] **/cassandra/test/burn/org/apache/cassandra/utils/LongBTreeTest.java:269: error: reference to testRandomSelection is ambiguous
[javac] testRandomSelection(perThreadTrees, perTreeSelections, (selection) -> {
[javac] ^
[javac] both method testRandomSelection(int,int,BTreeTestFactory) in LongBTreeTest and method testRandomSelection(int,int,Consumer<RandomSelection>) in LongBTreeTest match
[javac] **/cassandra/test/burn/org/apache/cassandra/utils/LongBTreeTest.java:269: error: incompatible types: bad return type in lambda expression
[javac] testRandomSelection(perThreadTrees, perTreeSelections, (selection) -> {
[javac] ^
[javac] missing return value

后来尝试用不同的JDK版本编译,发现jdk1.8.0_11还是有同样的问题,但是从jdk1.8.0_20开始,这个问题就解决了。

请问是什么原因造成的。谁能告诉我来自 JDK 的错误 ID?

最佳答案

看起来像 JDK-8029718实际上在 1.8.0_20 中已修复的错误。通常,在 1.8.0_20 和 1.8.0_40 中修复了与 lambda 类型推断相关的 javac 编译器中的许多错误。建议使用最新的编译器版本。

关于java - 关于 lambda 的 Cassandra 编译问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32421279/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com