MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    Solved Mirai-console插件开发的项目要求强制JDK1.8吗?

    开发交流
    4
    6
    155
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      Ling-YangHui last edited by

      我通过JDK15创建了项目,但是gradle完了以后发现之前写的增强switch全部都不能用了,请问这个情况怎么处理?

      1 Reply Last reply Reply Quote 0
      • S
        ShaoLongFei last edited by

        我用的 12 可以用

        1 Reply Last reply Reply Quote 0
        • Him188
          Him188 last edited by

          用户有可能只有 JRE 1.8 因此建议基于 1.8

          1 Reply Last reply Reply Quote 0
          • L
            Ling-YangHui last edited by

            现在的问题是想要指定它使用JDK15来执行编译,但是就算我在gradle里面写了
            java {
            sourceCompatibility = JavaVersion.VERSION_15
            targetCompatibility = JavaVersion.VERSION_15
            }
            重构gradle以后依然无法用15的语言特性来编译。
            报错显示为
            错误: -source 8 中不支持 switch 表达式
            return switch(groupID) {
            ^
            (请使用 -source 14 或更高版本以启用 switch 表达式)
            那么这个地方怎么修改使用-source 14呢?

            1 Reply Last reply Reply Quote 0
            • Karlatemp
              Karlatemp last edited by

              java 替换成 compileJava 试试

              L 1 Reply Last reply Reply Quote 0
              • L
                Ling-YangHui @Karlatemp last edited by

                @karlatemp 感谢,跑起来了

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact