eclipse-xtext / eclipse-xtext/xtext

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

Open
#3,535 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Xtext Gradle Builder Plugin configuration options and the Xtend Gradle compiler documentation linked in the issue, then trace how the Java toolchain and target level are passed to Xtend. Done means Gradle can run on JDK21 while Xtend-generated code compiles and tests run for the JDK11 target without using List.getLast().

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.