Kiran Muralee
Kiran Muralee

Reputation: 2060

Eclipse Luna version 4.4.2 not showing suggestions for java 8

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

Answers (1)

Tagir Valeev
Tagir Valeev

Reputation: 100249

Works fine for me in Eclipse Luna 4.4.2. I press Ctrl+1 when staying on new Runnable: Convert to lambda expression screenshot

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":

Save action

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

Related Questions