You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

IntelliJ IDEA编译JDK24预览特性报错求助:无法选字节码版本24

编译JDK24预览特性Stream Gatherers时的版本错误问题

我使用IntelliJ IDEA 2024.2.5(社区版),尝试编译包含Stream Gatherers(JDK24预览特性)的代码时,出现以下错误:

java: invalid source release 23 with --enable-preview
  (preview language features are only supported for release 24)

相关代码如下:

public static void gatherIntoWindows(List<String> countries) {
    List<List<String>> windows = countries
            .stream()
            .gather(Gatherers.windowSliding(3))
            .toList();
}

我已为项目下载JDK24,但无法选择目标字节码版本24,请问该错误是否由此导致?(附'--release 24'设置截图)

内容的提问来源于stack exchange,提问作者Kristina Perez

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 13:38:08