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>  


  • 2018-06-02 00:30:35

    Android 解决沉浸式状态栏下,输入法弹出,布局不会自动调整的BUG

    在开发中,如果输入框在布局的底部。在弹出输入发时,为了使输入法不遮挡输入框通常有两种做法: 1.将布局压缩(Activity的android:windowSoftInputMode属性设置为”adjustResize”)。 2.移动布局,将布局顶到输入框之上(Activity的android:windowSoftInputMode属性设置为”adjustPan”)

  • 2018-06-02 00:31:27

    Android layout实现输入法弹出后,布局整体上移

    那如果要实现沉浸式状态栏又要保持布局不会被输入法遮挡,怎么办呢? 只要在根布局加上android:fitsSystemWindows=”true”即可,效果如下(为方便看效果我把背景改成了黄色):

  • 2018-06-04 10:06:43

    mysql查询数据的同时对它进行删除操作

    今天遇见一个问题,需要把mysql数据库里面的 商品主表 和它的每一个条目对应不上的数据给全部删除(数据如下图);也就是整理一下数据库里的数据保证数据的可用;

  • 2018-06-19 16:39:03

    java缩放图片、java裁剪图片代码工具类

    在系统的上传图片功能中,我们无法控制用户上传图片的大小,用户可能会上传大到几十M小到1k的的图片,一方面图片太大占据了太多的空间,另一方面,我们没办法在页面上显示统一大小的图片。所以我们需要对用户上传的图片进行缩放和裁剪,这里的缩放和平常的压缩不是一个意思,因为要实现小的图片会放大,大的图片会缩小,而且是等比例变的,图片不会显示挤压的效果。而这种操作Java完全可以实现。下面分享下java缩放、裁剪图片的工具类。