Intellij - 无法使用较新的Java 8类 - 错误:“使用API​​记录为@since 1.6 + ..” [英] Intellij - Unable to use newer Java 8 classes - Error : "Usage of API documented as @since 1.6+.."

查看:350
本文介绍了Intellij - 无法使用较新的Java 8类 - 错误:“使用API​​记录为@since 1.6 + ..”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的java 8代码库中使用 java.lang.function.Function ,但我在Intellij中一直收到以下错误。

I'm trying to use a java.lang.function.Function in my java 8 code base, but i keep getting the following error in Intellij.


使用API​​记录为@since 1.6+此检查查找所有
用法的文档中包含@since标记的方法。当在较新的SDK版本下进行开发时,这个
可能很有用,因为
是生产的目标平台

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

I似乎有正确的项目和编译器设置

I seem to have the correct Project and Compiler settings

项目设置:(文件 - >项目结构)

Project Settings -> Project -> Project SDK = Java 1.8
Project Settings -> Project -> Project Language Level = 8 - Lambdas, Type Annotations etc

编译器设置:(文件 - >设置)

Build, Execution, Deployment -> Compiler -> Java Compiler -> Project Bytecode Version : 1.8
Build, Execution, Deployment -> Compiler -> Java Compiler -> Per module Bytecode Version -> Target Bytecode Version : 1.8

有什么问题?

推荐答案

根据Bastien Jansen评论编辑答案。

Edited the answer based on Bastien Jansen comment.

似乎还有另一个影响编译器级别的项目设置。这个问题的一个微妙的指示是当你的编译器开始抱怨源代码和目标java版本与你编译代码时指定的版本不同时

Seems that there is another project setting that affects the compiler level. A subtle indication of this problem is when your compiler starts complaining of the source and target java version being different from the one you specified while you are compiling the code

Warning:java: source value 1.5 is obsolete and will be removed in a future release
Warning:java: target value 1.5 is obsolete and will be removed in a future release
Warning:java: To suppress warnings about obsolete options, use -Xlint:-options.

要摆脱这个,你需要打开

To get rid of this, you need to open up

文件 - >项目结构 - >项目设置 - >模块 - > 您的模块名称 - >来源 - >语言水平

并将其更改为所需级别,即1.8或项目默认语言级别

and change that to the desired level i.e 1.8 or the Project Default language level

这篇关于Intellij - 无法使用较新的Java 8类 - 错误:“使用API​​记录为@since 1.6 + ..”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆