如何使Eclipse中的Java 8 lambda参数的代码完成工作? [英] How to make code completion for Java 8 lambda parameters in Eclipse work?

查看:334
本文介绍了如何使Eclipse中的Java 8 lambda参数的代码完成工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有这样的界面:

  @FunctionalInterface 
public interface ModifierFunction {

游戏applyModifier(游戏游戏,卡片,修饰符修饰符);
}

和我使用它的某些类:

  SHOWDOWN_BUFF((游戏,卡片,修饰符) - > {
游戏// //我没有得到Eclipse的建议
返回游戏;
})

我的问题是,如果我按 Ctrl + 空间我看不到游戏的方法...其实我根本没有提出任何建议。如果我使用这种语法,它不起作用:

  SHOWDOWN_BUFF((游戏游戏,卡片,修饰符修饰符) - > {
game。//< - 我没有从Eclipse获得任何提案
返回游戏;
})

如何让代码完成在Eclipse Luna for Java 8中工作?



编辑 :我正在使用版本:Luna Service Release 1(4.4.1)

解决方案

Java 8中的Lambda表达式与Eclipse Mars(4.5.0)一起使用。
https://www.eclipse.org/eclipse/news/4.5 /jdt.php


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)

解决方案

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

这篇关于如何使Eclipse中的Java 8 lambda参数的代码完成工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆