IntelliJ won't accept Java8 and diamonds at the end of List/Map

I'm using the latest JDK and everywhere from project creation to now everything is set to Java8 or SDK 8.

Still, intelliJ gives me this issue:

在这里输入图像描述

The red lamp tells me to change to Java7.

This is my project settings: 在这里输入图像描述

and this is the Modules section: 在这里输入图像描述

As you can see; I specifically changed it from the SDK default to java 8 when I got the error, but no result.

The compiler settings look like this: 在这里输入图像描述

I'm on a macbook and the intelliJ is the community version. Does anyone know why this is happening and how I fix it?


Try to run the project, if this is your error message:

Then I suggest you have a little look into your pom -file.

This project was built using the intelliJ maven project setting, and it was missing this lovely line of code:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

IntelliJ doesn't (at least in my case) generate the version in the pom (despite that I picked all the settings for it).


I tried specifying the compiler version in the plugin too, to no avail. Have you tried invalidating the cache? It's File -> Invalidate Caches/Restart... . I would probably restart as well for good measure.

链接地址: http://www.djcxy.com/p/72790.html

上一篇: 为什么不能在Java方法中将Integer和string传递给Object参数

下一篇: IntelliJ不会在List / Map的末尾接受Java8和钻石