JetBrains compilation error is due to project language level

This is described in the user manual of JetBrains. Project language level

It has two functions:

    check syntax compatibility when writing code. For example, if it is set to 7, you can’t use the features above jdk1.7 when writing code, no matter what version of JDK you use. Features like functional interfaces cannot be used, and the idea will prompt an error. Compile the source code to the bytecode of the target version. For example, if it is set to 6, the compiled code is JDK6 compatible regardless of whether JDK7 or 8 is used

     

Read More: