当前位置: 首页 > 知识库问答 >
问题:

关于lambda的Cassandra编译问题

丌官嘉福
2023-03-14

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的bug id吗?

共有1个答案

仉宪
2023-03-14

看起来像是JDK-8029718的bug,实际上是在1.8.0_20中修复的。一般来说,许多bug是在1.8.0_20和1.8.0_40中修复的,与lambda类型推断有关。建议使用最新的编译器版本。

 类似资料:
  • 我有一个包含一些用户对象的列表,我正在尝试对列表进行排序,但只使用方法引用,使用lambda表达式编译器会给出一个错误: 错误:

  • 关于本文 该教程中的大部分内容都能在常见的 Scheme 入门教材中找到,本教材中比较有特色的是关于 continuation 和 call/cc 的内容,这也是 Scheme 的一大特点,从这点来说有过一些编程经验(特别是Python和Javascript等动态语言)的程序员会觉得《Teach Yourself Scheme in Fixnum Days》非常适合他们,因为他们只有看一眼马上就明

  • 有人能解释一下为什么我会出现这些错误吗?

  • 沈洁元 目前是上海交通大学无线通信研究所的一名硕士研究生。他现在的研究领域主要在多载波CDMA系统的同步、信道估计、多用户检测等方面。Python语言(和Numeric库)是他目前在进行仿真和其他科研工作时使用的主要编程语言。在业余时间,他乐衷于各种FLOSS,如FreeBSD操作系统、PyGTK等等。电影、F1赛车和网球也是他的兴趣爱好。

  • 我在编译代码时遇到了这个问题。