Search code examples
javaintellij-idealambdaintellij-14

IntelliJ IDEA not supporting Lambda?


I'm working with this tutorial which uses lambda expressions.

Spring Boot - Bookmarks

But IntelliJ says always: cannot resolve method(<lambda expression>).

What do I have to check?

this.accountRepository.findByUsername(userId).orElseThrow(() -> new UserNotFoundException(userId));

Solution

  • It looks like your IntelliJ or your project is not setup to use Java 8.

    1. Open Project Structure
    2. Look into Project Settings | Project, the value of Project SDK should be 1.8
    3. Look into Platform Settings | SDK, there should be 1.8 listed

    It should look something like this:

    enter image description here