intellij 出现“Usage of API documented as @since 1.6+”的解决办法
今天玩wafer时,发现代码中出现“Usage of API documented as @since 1.6+”的错误提示。
错误详情
Usage of API documented as @since 1.6+ 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
解决方案
1、设置idea
File ->Project Structure->Project Settings -> Modules -> 你的Module名字 -> Sources -> Language Level->选个1.6或者以上的默认的就行。
2、设置Maven
版本号设成自己的,要等于或大于提示的版本号信息(因为有的可能提示1.7或1.8).
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
2
3
4
5
6
7
8
9
10
11
原因
在Java项目中必不可少的是我们要指定一个jdk。 在指定jdk的同时,还可以指定jdk的Language level,这个有点像我们工程最低支持版本。比如Language level 设置了5.0 只是就不能出现使用6.0/7.0特性的代码(即设置了5.0则将以其为检测版本,无法识别6/7的特性,故而报错)。 因为这些特性在5.0的环境下是无法编译的。 或者可以理解ide会安装Language level指定的jdk版本来对我们的代码进行编译,以及错误检查。 在IntelliJ中有两个地方设置这个参数。 这个设置针对整个工程,或者说是工程默认的。 上面解决方案中的是针对模块的,这里才是正在生效的设置。
附录
参考资料
intellij 出现“Usage of API documented as @since 1.6+”的解决办法
IntelliJ IDEA 之 jdk Language level 解决IDEA自动重置LanguageLevel和JavaCompiler版本的问题
除特别注明外,本站所有文章均为 windcoder 原创,转载请注明出处来自: intellij-chuxianusage-of-api-documented-as-since-1-6dejiejuebanfa

厉害,虽然我没看懂 哈哈