2015-09-06 38 views
2

Cassandra源代碼是最新的,它是從[email protected]克隆的:apache/cassandra.git。Cassandra編譯問題關於lambda

JDK版本爲1.8.0_05

操作系統:Linux 3.13.0-62泛型#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嗎?

回答

3

看起來像是在1.8.0_20中實際修復的JDK-8029718錯誤。通常,在與lambda類型推斷相關的javac編譯器中,1.8.0_20和1.8.0_40中修復了許多錯誤。建議使用最新的編譯器版本。

+0

同意,這是我所期望的答案。謝謝 – taigetco