How to make code completion for Java 8 lambda para

2019-04-29 05:36发布

问题:

Suppose I have an interface like this:

@FunctionalInterface
public interface ModifierFunction {

    Game applyModifier(Game game, Card card, Modifier modifier);
}

and some class where I use it:

SHOWDOWN_BUFF((game, card, modifier) -> {
    game. // <- I get no proposals from Eclipse here
    return game;
})

My problem is that if I press Ctrl+Space I can't see Game's methods...in fact I get no proposals at all. It does not work if I use this syntax either:

SHOWDOWN_BUFF((Game game, Card card, Modifier modifier) -> {
    game. // <- I get no proposals from Eclipse here either
    return game;
})

How can I get code completion to work in Eclipse Luna for Java 8?

edit: I'm using Version: Luna Service Release 1 (4.4.1)

回答1:

Parameter completion within Java 8 Lambda expression works with Eclipse Mars (4.5.0). https://www.eclipse.org/eclipse/news/4.5/jdt.php