Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » nonexistent lambda support in latest eclipse neon
nonexistent lambda support in latest eclipse neon [message #1749239] Sun, 04 December 2016 00:18 Go to next message
Sergei Karimov is currently offline Sergei KarimovFriend
Messages: 17
Registered: July 2009
Junior Member
Hello All!
For a long time I've managed to write java 5 code and never complained a bit.
But recently one guy wrote a lot of code using lambdas, so I gave it a try...
Let me say... eclipse neon (latest build) lambda support is nonexistent.

Example. Write some code inside lambda.
1. Press Ctrl+T.
What you expect: open implementation of some interface method you are pointing to.
What you get: Blank as hell list containing only outer class and not what you need.
2. press Ctrl+Alt+H
What you want: open call hierarchy of current method.
What you get: See only encapsulating method. and not even usual "{...}" what you would expect
3. press Ctrl+LClick on a method name
What you expect: open method declaration
What you get: it doesn't even underscored and nothing happens
4. write a call to a method that has a function argument (where we usually put lambda) enter lambda argument section (inside area between brackets (<here>) -> {}, press Ctrl+Shift+space
what you expect: see expected lambda arguments as they are declared in outer context that accepts this lambda
what you get: usual help on method arguments
5. same as before, press Ctrl+1, Ctrl+space
what you expect: eclipse offers you to write lambda for you with all required argument and sintax
what you get: nothing

I guess list continues on, I just haven't met all issues...

move back and forward a few lines outside lambda and everything working again.
I don't understand why new sintax that is only slightly different from anonymous classes that have been supported by eclipse for eons, brings so many troubles...

To be fair some features are working (refactor renaming, extract local variable, etc)

Java 8 released in 2014 year. It's 2 years since then! It has a hundred updates by now.
As a conservative developer I have a luxury to ignore new features and use what I know.
Eclipse being open source still doesn't have that luxury.
At least if you want to stay top browser on a market.

[Updated on: Sun, 04 December 2016 00:32]

Report message to a moderator

Re: nonexistent lambda support in latest eclipse neon [message #1749249 is a reply to message #1749239] Sun, 04 December 2016 11:34 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Regarding the title of your post: please first see corresponding help content like http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftips%2Fjdt_tips.html (search for "lambda") or if you're not the reading type, you may listen to Noopur's 2015 presentation at https://www.youtube.com/watch?v=nFqstziRrLs

For most of your examples, however, there's an intrinsic difficulty due to the design of lambda expressions in Java: all names inside a lambda expression can only be resolved when the enclosing lambda is resolved and type checked. The type of a lambda expression is determined by type inference (see JLS section 18), but "unfortunately", type inference requires to also look into the lambda body. This could basically mean: before the lambda is complete, the tool has not chance to figure out what it means, i.e., any content assist inside a lambda expression is only possible when the lambda expression is complete and correctly typed, which, I agree, is bad news if you want to use content assist to implement the lambda in the first place. This is nothing to blame Eclipse for, it's all determined by the design of Java's lambda expressions. One hint, though: if you use the explicitly typed variant of a lambda expression (convert using Ctrl+1), the tool should be able to provide more help, since less type inference is needed.

Luckily, the JDT team is making constant progress even towards more IDE features working inside incomplete lambda expressions. If you have specific examples where some of these functions don't work as expected, you could help the team by filing precise bug reports with reproducing examples, thanks.

Stephan
Previous Topic:Unable to import gradle project
Next Topic:10 year old bug in JDT
Goto Forum:
  


Current Time: Sat Apr 27 00:39:17 GMT 2024

Powered by FUDForum. Page generated in 0.03189 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top