簡體   English   中英

Eclipse 內部編譯器錯誤

[英]Eclipse internal compiler error

在 Eclipse 中使用此代碼時:

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Test {  
    public static void main(String[] args) {
        List<Object> objs = Arrays.asList(new Object(), new Object());
        Set<String> s = objs.stream().collect(HashSet::new, HashSet::add, Object::toString);
        System.out.println(s);
    }
}

我得到:

Internal compiler error: java.lang.ArrayIndexOutOfBoundsException: 0 at 
 org.eclipse.jdt.internal.compiler.lookup.ConstraintExpressionFormula.reduceReferenceExpressionCompatibility(ConstraintExpressionFormula
 .java:273)

我知道這是產生錯誤的這一行:

Set<String> s = objs.stream().collect(HashSet::new, HashSet::add, Object::toString);

不確定它是否相關,但我正在使用:

  • Eclipse 開普勒 4.3.2
  • 插件:Eclipse Java Development Tools Patch with Java 8 support (for Kepler SR2) and Eclipse Plug-in Development Environment Patch with Java 8 support (for Kepler SR2)

  • java.runtime.version=1.8.0-b132

這是屏幕截圖:

在此處輸入圖片說明

我知道 collect 方法不正確,但為什么我沒有編譯器錯誤告訴類似的內容:

- The method collect(Supplier<R>, BiConsumer<R,? super Object>, BiConsumer<R,R>) in the type Stream<Object> is not applicable for the arguments etc.

這看起來像Eclipse的bug 433085錯誤的副本430766 這旨在在 Eclipse 4.4 Luna M7 中修復。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM