![](/img/trans.png)
[英]IntelliJ error - java: try-with-resources is not supported in -source 1.6 error. Even though in project settings 1.7 JDK is selected
[英]Getting “method references are not supported in -source 1.7” in intellij, but my project setting have Java 1.8
嗨,我正在尝试运行一个使用方法引用的简单 Java 程序,但 IntelliJ 一直说:
method references are not supported in -source 1.7 (use -source 8 or higher to enable method references): 31
但是,当我打开我的项目设置时,ProjectSDK 设置为 1.8,项目语言级别设置为 8
当我单击模块时,语言级别设置为 8
如果我查看首选项 > 构建、执行、部署 > 构建工具 > Gradle
并查看 Gradle JVM 它说它与 1.8 的项目 SDK 相同。
另外,如果我查看 Preferences > Build, Execution, Deployment > Compiler > Java Compiler
喜欢在这里建议我得到 8 这是正确的。
那么为什么它给我那个错误信息呢? 我不相信我的项目中有任何 1.7。
你的 gradle 文件中的“sourceCompatibility”和“targetCompatibility”怎么样?
您可以尝试将这些属性放在:
def javaVersion = JavaVersion.VERSION_1_8;
sourceCompatibility=javaVersion;
targetCompatibility=javaVersion;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.