IntelliJ - Diamond types and Lambda expressions are not supported at language level 5

1.3k Views Asked by At

Recently IntelliJ has been giving me an error regarding the use of both lambda expressions and diamond types.

The error I get is Lambda expressions are not supported at language level '5'

I checked my project structure and it shows my language level is set to 8.

enter image description here

Thanks for your time.

2

There are 2 best solutions below

0
Bas Leijdekkers On BEST ANSWER

Check the language settings of the module. It is possible for modules to have a different language setting than the project. This makes it possible for different parts of the project to use different language levels.

0
Abhishek Gupta On

Check with the "maven-compiler-plugin" once. Try to put the version of java/JDK which you are targeting to get compiled. In my case I was using open Jdk 11 and for which I had to put below plugin in my pom.xml file, where under configuration tag I had to mention the JDK 11 version:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <source>11</source>
                <target>11</target>
            </configuration>
        </plugin>