出現如圖錯誤:
報錯信息:
Usage of API documented as @since 1.8+
This inspection finds all usages of methods that have @since tag in their documentation.
This may be useful when development is performed under newer SDK version as the target platform for production.apache
出現該問題的緣由是因爲使用了JAVA8的新特性,可是Language Level(最低可支持的版本)比較低,沒法支持這些特性。好比設置的Language Level爲6.0,但是卻使用了8.0/9.0的新特性,6.0沒法解析這些特性,所以IDE會報錯來提醒咱們。maven
若是對最低支持版本有要求,沒辦法改動的話,那就只能放棄使用報錯部分的代碼。
若是對支持版本沒有要求的話,能夠改動IDE的Language Level來消除錯誤。ui
使用ctrl+shift+alt+S,打開Project Structure,選中側邊欄的Modules,在Sources窗口中修改Language Level(必須大於等於報錯信息給出的level)。改動後,IDE錯誤消失。
spa
Maven項目每一個Module都有單獨的pom.xml,若是不在pom.xml中進行配置,則默認將Module的Language Level設置爲5。因此要在pom.xml文件中添加插件進行配置。.net
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.0</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>