Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ jobs:
strategy:
matrix: # 'macos-14' is arm64
os: ['ubuntu-22.04', 'macos-14', 'windows-2022']
java: [ 21 ]
java: [ 25 ]
Copy link
Copy Markdown
Contributor Author

@HannesWell HannesWell Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case just minimal support is added for Java-25 at the moment the main build could also stay at Java-21 and just one extra branch for Java-25 could be added.

additional-maven-args: ['']
additional-label: ['']
include:
- os: ubuntu-22.04
java: 21
additional-maven-args: -Pstrict-jdk-21
additional-label: -strict
- os: ubuntu-22.04
java: 25
additional-maven-args: -Pstrict-jdk-25
additional-label: -strict
fail-fast: false
runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -82,7 +86,7 @@ jobs:
- name: 'Set up Java'
uses: actions/setup-java@v5
with:
java-version: 21
java-version: 25
distribution: 'temurin'

- name: 'Cache Maven packages'
Expand All @@ -100,7 +104,7 @@ jobs:
clean verify
-f org.eclipse.xtext.maven.releng
-B -fae -PuseJenkinsSnapshots
-Pstrict-jdk-21
-Pstrict-jdk-25

- name: Archive Test Results
uses: actions/upload-artifact@v7.0.0
Expand Down
8 changes: 6 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pipeline {
parameters {
choice(name: 'TARGET_PLATFORM', choices: ['r202403', 'r202406', 'r202409', 'r202412', 'r202503', 'r202506', 'r202509', 'r202512', 'r202603', 'latest'], description: 'Which Target Platform should be used?')
// see https://wiki.eclipse.org/Jenkins#JDK
choice(name: 'JDK_VERSION', choices: [ '17', '21' ], description: 'Which JDK version should be used?')
choice(name: 'JDK_VERSION', choices: [ '17', '21', '25' ], description: 'Which JDK version should be used?')
}

triggers {
Expand Down Expand Up @@ -61,6 +61,7 @@ pipeline {
// Set all Java version that can be discovered/selected by maven-toolchains-plugin
JAVA_17_HOME = tool(type:'jdk', name:'temurin-jdk17-latest')
JAVA_21_HOME = tool(type:'jdk', name:'temurin-jdk21-latest')
JAVA_25_HOME = tool(type:'jdk', name:'temurin-jdk25-latest')
}
steps {
xvnc(useXauthority: true) {
Expand Down Expand Up @@ -178,7 +179,10 @@ def selectedTargetPlatform() {
def isUpstream = isTriggeredByUpstream()
def javaVersion = javaVersion()

if (isTriggeredByUpstream() && javaVersion>=21) {
if (isTriggeredByUpstream() && javaVersion>=25) {
println("Choosing 'latest' target since this build was triggered by upstream with Java ${javaVersion}")
return 'latest'
} else if (isTriggeredByUpstream() && javaVersion>=21) {
println("Choosing 'latest' target since this build was triggered by upstream with Java ${javaVersion}")
return 'latest'
} else if (isTriggeredByUpstream() && javaVersion>=17) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2020,21 +2020,21 @@ class ImportOrganizerTest extends AbstractXtendTestCase {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=399519
@Test def testExtensionFeatureCallToStaticLocalFieldFromSuper() {
'''
import java.util.Collections
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Collections is final in Java-25 and wasn't in Java-21 and before:

So I searched for another class that's not final and has (directly or inherited) static methods that could be used for this test.
And ArrayList seemed a simple replacement where the static methods from the List interface could be used (and it was similar).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the past, when supporting Java 21, I had similar problems due to changes in the JDK. I solved them by NOT using JDK types for tests: I crafted a few Java types (stub classes) with the requirements for our tests.

If you need a "class that's not final and has (directly or inherited) static methods" I'd create a stub class in that tests project and use that one in the test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea.
But since it's working now, I would be fine to leave it as it is for now. However, if you'd prefer to have it changed, I can implement your suggestion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on how much work it requires.
If it's not that much, I'd do it now so we can continue removing our dependencies on JDK, which will likely break in future JDK versions.
If it takes too much time, now that it works we can leave it like that; in the future it might break again ;)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have this problem on a regular base so i am fine with adjusting stuff while keeping the intent of the test

import java.util.ArrayList

import static extension java.util.Collections.*
import static extension java.util.List.*

class Foo extends Collections {
class Foo extends ArrayList {
def foo() {
''.singleton
''.of
}
}
'''.assertIsOrganizedTo('''
import java.util.Collections
import java.util.ArrayList

class Foo extends Collections {
class Foo extends ArrayList {
def foo() {
''.singleton
''.of
}
}
''')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3875,36 +3875,36 @@ public void testExtensionFeatureCallToStaticLocal() {
@Test
public void testExtensionFeatureCallToStaticLocalFieldFromSuper() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("import java.util.Collections");
_builder.append("import java.util.ArrayList");
_builder.newLine();
_builder.newLine();
_builder.append("import static extension java.util.Collections.*");
_builder.append("import static extension java.util.List.*");
_builder.newLine();
_builder.newLine();
_builder.append("class Foo extends Collections {");
_builder.append("class Foo extends ArrayList {");
_builder.newLine();
_builder.append("\t");
_builder.append("def foo() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\'\'.singleton");
_builder.append("\'\'.of");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("import java.util.Collections");
_builder_1.append("import java.util.ArrayList");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("class Foo extends Collections {");
_builder_1.append("class Foo extends ArrayList {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def foo() {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("\'\'.singleton");
_builder_1.append("\'\'.of");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ public void simpleJava21Project() throws Exception {
verifyErrorFreeLog(ROOT + "/simple-java21");
}

@Test
public void simpleJava25Project() throws Exception {
Assume.assumeTrue("Active only on Java 25 and later", JavaRuntimeVersion.isJava25OrLater());
verifyErrorFreeLog(ROOT + "/simple-java21");
}

@Test
public void encoding() throws Exception {
Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/encoding");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Djava-25
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.xtext</groupId>
<artifactId>it-tests-parent</artifactId>
<version>IT-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>simple-java25</artifactId>
<properties>
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtend-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package test;

public record JavaRecord(String name) {
public XtendA foo(XtendA test) {
return test;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package test

class XtendA {
def JavaRecord newJavaRecord() {
return new JavaRecord("a test")
}

def String aName(JavaRecord r) {
r.name
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -319,18 +320,19 @@ public void testFindTypeByName_javaLangCharSequence_01() {
@Test
public void testFindTypeByName_javaLangCharSequence_02() {
String typeName = CharSequence.class.getName();
try {
Set<String> memberNames = Sets.newHashSet("length", "chars", "charAt", "codePoints", "subSequence", "toString");
assertMembers(typeName, memberNames);
} catch(AssertionError e) {
try {
Set<String> memberNamesJ11 = Sets.newHashSet("length", "chars", "charAt", "codePoints", "subSequence", "toString", "compare");
assertMembers(typeName, memberNamesJ11);
} catch (AssertionError e2) {
Set<String> memberNamesJ15 = Sets.newHashSet("length", "chars", "charAt", "codePoints", "isEmpty", "subSequence", "toString", "compare");
assertMembers(typeName, memberNamesJ15);
}
int javaVersion = Runtime.version().feature();
Set<String> expectedMemberNames = new HashSet<>(
Set.of("length", "chars", "charAt", "codePoints", "subSequence", "toString"));
if (javaVersion >= 11) {
expectedMemberNames.add("compare");
}
if (javaVersion >= 15) {
expectedMemberNames.add("isEmpty");
}
if (javaVersion >= 25) {
expectedMemberNames.add("getChars");
}
assertMembers(typeName, expectedMemberNames);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -321,18 +322,19 @@ public void testFindTypeByName_javaLangCharSequence_01() {
@Test
public void testFindTypeByName_javaLangCharSequence_02() {
String typeName = CharSequence.class.getName();
try {
Set<String> memberNames = Sets.newHashSet("length", "chars", "charAt", "codePoints", "subSequence", "toString");
assertMembers(typeName, memberNames);
} catch(AssertionError e) {
try {
Set<String> memberNamesJ11 = Sets.newHashSet("length", "chars", "charAt", "codePoints", "subSequence", "toString", "compare");
assertMembers(typeName, memberNamesJ11);
} catch (AssertionError e2) {
Set<String> memberNamesJ15 = Sets.newHashSet("length", "chars", "charAt", "codePoints", "isEmpty", "subSequence", "toString", "compare");
assertMembers(typeName, memberNamesJ15);
}
int javaVersion = Runtime.version().feature();
Set<String> expectedMemberNames = new HashSet<>(
Set.of("length", "chars", "charAt", "codePoints", "subSequence", "toString"));
if (javaVersion >= 11) {
expectedMemberNames.add("compare");
}
if (javaVersion >= 15) {
expectedMemberNames.add("isEmpty");
}
if (javaVersion >= 25) {
expectedMemberNames.add("getChars");
}
assertMembers(typeName, expectedMemberNames);
}

@Test
Expand Down
23 changes: 23 additions & 0 deletions org.eclipse.xtext.dev-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,29 @@
</plugins>
</build>
</profile>
<profile>
<!--
To be activated explicitly when using Java 25 to get
the latest version of JDT to access Java 25 new features.

The profile must be activated through the system property "java-25"
either on the command line "-Djava-25", or by creating the file
"maven.config" inside the folder ".mvn" at the root of the
project, with the content "-Djava-25"
-->
<id>java-25</id>
<activation>
<property>
<name>java-25</name>
</property>
</activation>
<properties>
<!-- This version supports Java 25 but requires Java 17;
for the moment we activate it only when building with Java 25. -->
<org.eclipse.jdt.core-version>3.44.0</org.eclipse.jdt.core-version>
</properties>
</profile>

</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -325,18 +326,19 @@ public void testFindTypeByName_javaLangCharSequence_01() {
@Test
public void testFindTypeByName_javaLangCharSequence_02() {
String typeName = CharSequence.class.getName();
try {
Set<String> memberNames = Sets.newHashSet("length", "chars", "charAt", "codePoints", "subSequence", "toString");
assertMembers(typeName, memberNames);
} catch(AssertionError e) {
try {
Set<String> memberNamesJ11 = Sets.newHashSet("length", "chars", "charAt", "codePoints", "subSequence", "toString", "compare");
assertMembers(typeName, memberNamesJ11);
} catch (AssertionError e2) {
Set<String> memberNamesJ15 = Sets.newHashSet("length", "chars", "charAt", "codePoints", "isEmpty", "subSequence", "toString", "compare");
assertMembers(typeName, memberNamesJ15);
}
int javaVersion = Runtime.version().feature();
Set<String> expectedMemberNames = new HashSet<>(
Set.of("length", "chars", "charAt", "codePoints", "subSequence", "toString"));
if (javaVersion >= 11) {
expectedMemberNames.add("compare");
}
if (javaVersion >= 15) {
expectedMemberNames.add("isEmpty");
}
if (javaVersion >= 25) {
expectedMemberNames.add("getChars");
}
assertMembers(typeName, expectedMemberNames);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
public class JavaVersionTest {
@Test
public void test_fromBree() {
assertEquals(JavaVersion.JAVA25, JavaVersion.fromBree("JavaSE-25"));
assertEquals(JavaVersion.JAVA21, JavaVersion.fromBree("JavaSE-21"));
assertEquals(JavaVersion.JAVA17, JavaVersion.fromBree("JavaSE-17"));
assertEquals(JavaVersion.JAVA11, JavaVersion.fromBree("JavaSE-11"));
Expand All @@ -31,6 +32,8 @@ public void test_fromBree() {

@Test
public void testFromQualifier() {
assertEquals(JavaVersion.JAVA25, JavaVersion.fromQualifier("25"));
assertEquals(JavaVersion.JAVA25, JavaVersion.fromQualifier("1.25"));
assertEquals(JavaVersion.JAVA21, JavaVersion.fromQualifier("21"));
assertEquals(JavaVersion.JAVA21, JavaVersion.fromQualifier("1.21"));
assertEquals(JavaVersion.JAVA17, JavaVersion.fromQualifier("17"));
Expand All @@ -55,6 +58,7 @@ public void testFromQualifier() {

@Test
public void test_getQualifier() {
assertEquals("25", JavaVersion.JAVA25.getQualifier());
assertEquals("21", JavaVersion.JAVA21.getQualifier());
assertEquals("17", JavaVersion.JAVA17.getQualifier());
assertEquals("11", JavaVersion.JAVA11.getQualifier());
Expand All @@ -73,6 +77,7 @@ public void test_isAtLeast() {

@Test
public void test_toJdtClassFileConstant () {
assertEquals(4521984, JavaVersion.JAVA25.toJdtClassFileConstant());
assertEquals(4259840, JavaVersion.JAVA21.toJdtClassFileConstant());
assertEquals(3997696, JavaVersion.JAVA17.toJdtClassFileConstant());
assertEquals(3604480, JavaVersion.JAVA11.toJdtClassFileConstant());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,18 @@ public static void main(String[] args) {
project.getIdeProject().setEnabled(true);
project.getWebProject().setEnabled(true);
project.getP2Project().setEnabled(true);
}), CliWizardIntegrationTest.newProjectConfig(project -> {
project.setBaseName("mavenTychoP2J25");
project.setJavaVersion(JavaVersion.JAVA25);
project.setPreferredBuildSystem(BuildSystem.MAVEN);
project.setSourceLayout(SourceLayout.PLAIN);
project.setProjectLayout(ProjectLayout.HIERARCHICAL);
project.getRuntimeProject().getTestProject().setEnabled(true);
project.getUiProject().setEnabled(true);
project.getUiProject().getTestProject().setEnabled(true);
project.getIdeProject().setEnabled(true);
project.getWebProject().setEnabled(true);
project.getP2Project().setEnabled(true);
}), CliWizardIntegrationTest.newProjectConfig(project -> {
project.setBaseName("full");
project.setPreferredBuildSystem(BuildSystem.GRADLE);
Expand Down
Loading
Loading