Language level版本过低,找到项目结构,换成更高版本即可
下面这个更重要
将对应值提高,如果没有这段代码,添加即可
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>