Reputation: 2060
I recently installed Java 8 64 bit version on my machine and installed Eclipse Luna version 4.4.2 64 bit.However when I programme a java application,the IDE not showing auto suggestions to use Java 8 features like use lambda expressions instead of anonymous inner class.The code I have used is given below.As my reputation is low I am not able to post images.
public static void main(String[] args) {
Thread t=new Thread(new Runnable() {
@Override
public void run() {
System.out.println("Run method called");
}
});
t.start();
}
Upvotes: 0
Views: 561
Reputation: 100249
Works fine for me in Eclipse Luna 4.4.2. I press Ctrl+1 when staying on new Runnable
:
Seems that there's no way to mark it as warning (yellow lightbulb). However you can switch on a save action for lambda. Go to Preferences -> Java -> Editor -> Save Actions, check "Additional actions", press "Configure", go to "Code style" tab and check the "Convert functional interface instances":
This way all the anonymous classes which can be converted to lambdas will be converted automatically upon you press Ctrl+S. You can also make this conversion for the whole project at once: select the project in Package explorer, right-click, Source, Clean up, Use custom profile, configure and check the same checkbox.
Upvotes: 4