intellij 出现“Usage of API documented as @since 1.6+”的解决办法

2018-01-17 16:42:59

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

 

File ->Project Structure->Project Settings -> Modules -> 你的Module名字 -> Sources -> Language Level->选个默认的就行。



1、error 1:Intellij Error:usage of api documented as @since 1.6+

错误场景:

开发工具:Intellij

在使用最新的Java8库的时候(我用的是Date.toInstant() ),在调用该方法的地方会有错误提示:

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

问题解决:

    查阅资料发现这可能是其他项目的设置影响了编译器的等级。当编译器发现源代码和目标Java版本与设置的编译版本不同时,便会报这个错误。

    要解决该问题,需作如下配置:Flie -> Project Structure -> Project Settings -> Modules -> "Your Module Name" -> Sources ->Language Level ,然后将其更改为所需级别,即8或"项目默认语言级别"。


2、error 2: Error:java: Compilation failed: internal java compiler error


问题解决:按照方法1修改语言级别后,Maven-->Reimport, 再次编译,问题会还原,所以这样不能根本解决问题。

需要做的是在Maven依赖配置文件pom.xml中添加complier插件,并且指定版本,就不会再报错了:

[java] view plain copy

  1. <build>  

  2.     <plugins>  

  3.         <plugin>  

  4.             <groupId>org.apache.maven.plugins</groupId>  

  5.             <artifactId>maven-compiler-plugin</artifactId>  

  6.             <version>3.6.0</version>  

  7.             <configuration>  

  8.                 <source>1.8</source>  

  9.                 <target>1.8</target>  

  10.             </configuration>  

  11.         </plugin>  

  12.     </plugins>  

  13. </build>  


  • 2021-03-02 16:00:30

    git pull时的filename too long的错误

    这是因为git在windowa下的文件名长度最大是260,(git在Linux下最大支持4096长度的文件名),可以通过输入以下命令解决:

  • 2021-03-05 13:18:03

    mjml教程详解

    mjml如何快速编写响应式电子邮件

  • 2021-03-15 10:34:55

    Sass函数:Sass Maps的函数-map-get($map,$key)

    map-get($map,$key) 函数的作用是根据 $key 参数,返回 $key 在 $map 中对应的 value 值。如果 $key 不存在 $map中,将返回 null 值。此函数包括两个参数: