0
votes

Eclipse Java EE IDE for Web Developers. Version: Luna Release (4.4.0) Build id: 20140612-0600


I'm using the release version of Eclipse Luna for Java (Java EE), and it seems that there's no content assist for the new Java 8-style method references. In the example below, I hit Ctrl-Space after the '::', expecting to see the list of methods available on the class Match. Instead I just get some generic template assist, even if I cycle through all the assist menus. Normal content assist on methods work fine, it's just Java 8 method references (::) that don't work.

enter image description here

Is this supposed to work? If not, why not? By design? Bug?

2

2 Answers

3
votes

Looks like this might be Eclipse bug 430656.

Method reference content assist does work in some places but not in 'invocation contexts'.

0
votes

A possible work-around: Eclipse Luna 4.4.0 and 4.4.1 does include support for method reference syntax, but not in the in-line context you're trying. It does work if you declare the method reference as a variable with a specific type, however. Like this:

Function<String, Object> methodRef = String::valueOf;
new LinkedList<String>().stream().map(methodRef);

In this code, content-assist works correctly at the :: point.