IntelliJ IDEA 13 uses Java 1.5 despite setting to 1.7
Solution 1:
Please check your project/module language levels (Project Structure | Project; Project Structure | Modules | module-name | Sources). You might also want to take a look at Settings | Compiler | Java Compiler | Per-module bytecode version.
Set also this:
File -> Project Structure -> Modules :: Sources (next to Paths and Dependencies) and that has a "Language level" option which also needs to be set correctly.
Solution 2:
If nothing of this helps (my case), you can set it in your pom.xml, like this:
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
As this cool guy mentioned here: https://stackoverflow.com/a/25888116/1643465
Solution 3:
[For IntelliJ IDEA 2016.2]
I would like to expand upon part of Peter Gromov's answer with an up-to-date screenshot. Specifically this particular part:
You might also want to take a look at Settings | Compiler | Java Compiler | Per-module bytecode version.
I believe that (at least in 2016.2): checking out different commits in git
resets these to 1.5.