Intellij – 无法使用较新的Java 8类 – 错误:“API的用法记录为@since 1.6+
来源:互联网 发布:网络暴力的调查报告 编辑:程序博客网 时间:2024/06/05 19:06
问题描述
我试图在我的java 8代码库中使用java.lang.function.Function
,但是我在Intellij中收到以下错误。
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
我似乎有正确的项目和编译器设置
项目设置:
Project Settings -> Project -> Project SDK = Java 1.8Project Settings -> Project -> Project Language Level = 8 - Lambdas, Type Annotations etc
编译器设置:
Build, Execution, Deployment -> Compiler -> Java Compiler -> Project Bytecode Version : 1.8Build, Execution, Deployment -> Compiler -> Java Compiler -> Per module Bytecode Version -> Target Bytecode Version : 1.8
问题是什么?
最佳解决方案
根据Bastien Jansen评论编辑了答案。
似乎有另一个影响编译器级别的项目设置。这个问题的一个微妙的指示是编译器开始抱怨源和目标java版本与您在编译代码时指定的版本不同
Warning:java: source value 1.5 is obsolete and will be removed in a future releaseWarning:java: target value 1.5 is obsolete and will be removed in a future releaseWarning:java: To suppress warnings about obsolete options, use -Xlint:-options.
要摆脱这一点,你需要开放
File -> Project Structure -> Project Settings -> Modules -> "Your Module Name" -> Sources -> Language Level
并将其改为所需的级别,即1.8或默认项目默认语言级别
次佳解决方案
如果您使用maven,然后在配置pom.xml文件中添加以下行,然后从maven重新导入或构建它。
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins></build>
否则,从下面的路径中选择java编译器和语言级别。
文件>项目结构>项目设置>模块>你的模块名称>来源>语言水平>选择你需要的那个。
从这里改变语言水平: –
第三种解决方案
实际上,如果您使用Maven并且您的pom.xml
项目属性配置正确
<project xmlns="...> ....<properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target></properties>...</project
您可以将Maven参数重新导入到intellij-idea
项目中 – 右键单击项目根目录,然后在底部的Maven -> Reimport
。
参考文献
- Intellij – Unable to use newer Java 8 classes – Error : “Usage of API documented as @since 1.6+..”
- Intellij – 无法使用较新的Java 8类 – 错误:“API的用法记录为@since 1.6+
- intellij 出现“Usage of API documented as @since 1.6+”的解决办法
- intellij IDEA 出现“Usage of API documented as @since 1.6+”的解决办法
- Intellij IDEA 出现“Usage of API documented as @since 1.6+”的解决办法
- intellij 出现“Usage of API documented as @since 1.6+”的解决办法
- Intellij IDEA 出现“Usage of API documented as @since 1.6+”的解决办法
- Intellij IDEA 出现“Usage of API documented as @since 1.6+”的解决办法
- intellij idea出现“Usage of API documented as @since 1.6+”的解决办法
- Intellij IDEA 出现“Usage of API documented as @since 1.6+”的解决办法
- since的用法.
- Intellij Error:usage of api documented as @since 1.6+Error:java: Compilation failed: internal java c
- intellij 出现“Usage of API documented as @since 1.8+”的解决办法
- Intellij 出现“Usage of API documented as @since 1.4+”的解决办法
- Intellij IDEA 出现“Usage of API documented as @since 1.7+”的解决办法
- intellij idea 出现“Usage of API documented as @since 1.8+”的解决办法
- HTML5较HTML4新标签的用法以及区别
- idea "Usage of API documented as @since 1.6+"的解决办法
- 使用IntelliJ idea创建的java工程无法编辑
- php从数据库中取二进制流文件转换为图片,图片以二进制流存入数据库实现
- 一生学做人
- 【python】mysql connector
- 二叉树的建立和遍历程序代码(Java,C)
- 学习Java分为几个阶段,分别是什么?
- Intellij – 无法使用较新的Java 8类 – 错误:“API的用法记录为@since 1.6+
- nginx
- Redis集合
- 谈谈对Spring IOC的理解
- 系统编程函数之文件目录操作
- 排除工作日计算任务是否超期
- 一位ACM过来人的心得
- 初学文件IO
- Import WPA from FreeBSD