Eclipse内部编译器错误

时间:2014-04-23 16:36:27

标签: java eclipse java-8

在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 Kepler 4.3.2
  • 插件:支持Java 8的Eclipse Java开发工具修补程序(适用于Kepler SR2)和支持Java 8的Eclipse插件开发环境修补程序(适用于Kepler SR2)

  • java.runtime.version = 1.8.0-B132

这是截图:

enter image description here

我知道收集方法不正确,但为什么我没有编译器错误告诉类似:

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

1 个答案:

答案 0 :(得分:2)

这看起来像Eclipse bug 433085是bug 430766的副本。这个目标是在Eclipse 4.4 Luna M7中修复。