Skip to content

Commit be9a969

Browse files
committed
Allow build JVM to be with Java 21
xtend converts `.last` to `List.getLast()` if the JVM it is running under has it, so the generated java files will use `List.getLast()` even though we want to target older JVM. `List.getLast()` was introduced in Java 21, which is newer than our supported version of Java11. This is the workaround recommended in eclipse-xtext/xtext#3535
1 parent 74396fe commit be9a969

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

gradle/versions.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
version = '1.0.0-SNAPSHOT'
1414

1515
ext.versions = [
16-
'xtend_lib': '2.32.0',
1716
// Additional JDK version configuration is in java-compiler-settings
1817
'java': '11',
1918

19+
'xtend_lib': '2.40.0',
2020
'guava': '[32.1.2,34)',
2121
'gson': '[2.9.1,3.0)',
2222

org.eclipse.lsp4j.generator/src/main/java/org/eclipse/lsp4j/generator/JsonRpcDataTransformationContext.xtend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class JsonRpcDataTransformationContext implements TransformationContext {
5151
def TypeReference getRightType(TypeReference typeReference) {
5252
val type = typeReference.type
5353
if (type === eitherType.type) {
54-
return typeReference.actualTypeArguments.last
54+
return IterableExtensions.lastOrNull(typeReference.actualTypeArguments)
5555
}
5656
if (type instanceof InterfaceDeclaration) {
5757
return type.extendedInterfaces.map[rightType].filterNull.head

0 commit comments

Comments
 (0)