【发布时间】:2015-01-21 16:20:42
【问题描述】:
假设我有一个这样的界面:
@FunctionalInterface
public interface ModifierFunction {
Game applyModifier(Game game, Card card, Modifier modifier);
}
还有一些我使用它的类:
SHOWDOWN_BUFF((game, card, modifier) -> {
game. // <- I get no proposals from Eclipse here
return game;
})
我的问题是,如果我按 Ctrl+Space 我看不到 Game 的方法...事实上我根本没有收到任何建议。如果我使用这种语法,它也不起作用:
SHOWDOWN_BUFF((Game game, Card card, Modifier modifier) -> {
game. // <- I get no proposals from Eclipse here either
return game;
})
如何让代码完成以在 Eclipse Luna for Java 8 中工作?
编辑:我正在使用版本:Luna Service Release 1 (4.4.1)
【问题讨论】:
-
我尝试过 IDEA,但它缺少一些我在 Eclipse 中每天都使用的功能。
-
您使用的是什么版本的 Eclipse?您是否已将项目配置为使用 Java 8 合规性和库?
-
我有 java 8 合规性和库。
-
呃哦,我还在等待 Eclipse 的编译器符合标准,并且不会一直在类型推断上失败,等等。然后我可能会要求代码完成在 lambdas 中也是如此……
-
我放弃了,改用 IntelliJ IDEA。他们修复了我当时不喜欢的大部分东西。