Skip to content

Using Gradle with JDK21 but targeting Java 11 with xtext/xtend #3535

@sebthom

Description

@sebthom

I am trying to configure the LSP4J build config in a way that the JDK that runs Gradle is decoupled from the JDK that is used to compile and run tests using toolchains. LSP4J targets JDK11 and I'd like to use JDK21 to run Gradle.

However when doing so, the XText compiler emits Java source code with List.getLast() instructions. getLast() is not available in JDK11 thus the compilation fails. I saw that for the XText Gradle Builder Plugin one can specify the Java Source Level via xtext { generator { javaSourceLevel = 11 }} but I cannot find such setting for the Xtend Compiler https://xtext.github.io/xtext-gradle-plugin/xtend.html

How can I instruct the Xtend Compiler not to use Java Features newer than Java 11 in Gradle if I want to run gradle with a newer JDK?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions