Java 关于lambda的Cassandra编译问题
卡桑德拉的源代码是最新的,它是从git@github.com:apache/cassandra.git JDK版本是1.8.0_05 操作系统:Linux 3.13.0-62-generic#102 Ubuntu SMPJava 关于lambda的Cassandra编译问题,java,lambda,cassandra,java-8,Java,Lambda,Cassandra,Java 8,卡桑德拉的源代码是最新的,它是从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 [java
[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
[javac]**/cassandra/test/burn/org/apache/cassandra/utils/longbtreets.java:83:错误:对testRandomSelection的引用不明确
[javac]testRandomSelection(perThreadTrees、pertrees、,
[javac]^
[javac]LongBTreeTest中的方法testRandomSelection(int,int,BTreeTestFactory)和LongBTreeTest匹配中的方法testRandomSelection(int,int,Consumer)
[javac]**/cassandra/test/burn/org/apache/cassandra/utils/longbtreets.java:157:错误:对testRandomSelection的引用不明确
[javac]testRandomSelection(perThreadTrees,4,
[javac]^
[javac]LongBTreeTest中的方法testRandomSelection(int,int,BTreeTestFactory)和LongBTreeTest匹配中的方法testRandomSelection(int,int,Consumer)
[javac]**/cassandra/test/burn/org/apache/cassandra/utils/longbtreets.java:158:错误:不兼容类型:lambda表达式中的返回类型错误
[javac](选择)->
[javac]^
[javac]缺少返回值
[javac]**/cassandra/test/burn/org/apache/cassandra/utils/longbtreets.java:269:错误:对testRandomSelection的引用不明确
[javac]testRandomSelection(perThreadTrees,perTreeSelections,(selection)->{
[javac]^
[javac]LongBTreeTest中的方法testRandomSelection(int,int,BTreeTestFactory)和LongBTreeTest匹配中的方法testRandomSelection(int,int,Consumer)
[javac]**/cassandra/test/burn/org/apache/cassandra/utils/longbtreets.java:269:错误:不兼容类型:lambda表达式中的返回类型错误
[javac]testRandomSelection(perThreadTrees,perTreeSelections,(selection)->{
[javac]^
[javac]缺少返回值
后来,我尝试使用不同的JDK版本来编译它,发现jdk1.8.0_11仍然存在相同的问题,但是从jdk1.8.0_20开始,这个问题已经解决了
我想问是什么导致了这个问题。有人能告诉我JDK的bug id吗?看起来像是在1.8.0_20中实际修复的bug。一般来说,许多bug都在与lambda类型推断相关的javac编译器的1.8.0_20和1.8.0_40中修复。建议使用最新的编译器版本。同意,这是我所期望的答案谢谢