Add compiler support for Java-25 and set up a Java-25 build#3604
Conversation
| matrix: # 'macos-14' is arm64 | ||
| os: ['ubuntu-22.04', 'macos-14', 'windows-2022'] | ||
| java: [ 21 ] | ||
| java: [ 25 ] |
There was a problem hiding this comment.
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.
|
what is still unclear to me: how does this work without changes to bom |
| // assertEquals(ClassFileConstants.JDK21, JavaVersion.JAVA21.toJdtClassFileConstant()); | ||
| assertEquals(4259840, JavaVersion.JAVA21.toJdtClassFileConstant()); | ||
| // assertEquals(ClassFileConstants.JDK25, JavaVersion.JAVA25.toJdtClassFileConstant()); | ||
| assertEquals(4521984, JavaVersion.JAVA25.toJdtClassFileConstant()); |
There was a problem hiding this comment.
i assume we need to use the try catch approach here
There was a problem hiding this comment.
Why? I don't see anything referenced that's not available in the baseline Java or Eclipse version?
There was a problem hiding this comment.
also in the 2024-03 target platform / the one that is also used in maven bom?
There was a problem hiding this comment.
in the past we did some reflection in that test instead of
4521984
There was a problem hiding this comment.
also in the 2024-03 target platform / the one that is also used in maven bom?
It should be yes. Eclipse 2025-12 had complete Java-25 support and since Java-21 was released two years earlier I expect the 21 constants to be available since 2023-12.
And I also ran the Jenkins build in the m2e JIPP with the lowest TP and java-17 and it succeeded.
in the past we did some reflection in that test instead of
That would work too, but I think the approach to just inline the value (implemented before by @LorenzoBettini) is simpler.
And the later expected code is already available as commented out code.
There was a problem hiding this comment.
Yes, IIRC, in the past I had inlined a constant for such a scenario. I did that because someone else had done that in the past.
There was a problem hiding this comment.
can clean this up with my big bump pr in follow up
Test Results 8 054 files + 1 593 8 054 suites +1 593 3h 52m 50s ⏱️ + 49m 4s Results for commit c114fa8. ± Comparison against base commit 479dbc8. This pull request removes 124 and adds 6 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Indeed. |
|
i also assume it wont work at runtime due to bom |
|
What bom are you referring to exactly? |
|
stuff like the xtext maven plugin uses the bom i have linked above / in the other discussionhttps://github.com/eclipse-xtext/xtext/blob/425a9bee287588415dacc1042ce9e31f4ac7a3fa/org.eclipse.xtext.dev-bom/pom.xml#L273 |
4419731 to
8d1b756
Compare
In the meantime I added a java-25 profile to the BOM. But I'm not sure if it is actually necessary, because the Furthermore I added a dedicated compiler and wizard tests for Java-25 and adapted failing tests. In the current state all Github and Jenkins builds (executed in the m2e JIPP) succeeded in my testing. Please let me know if something is missing. |
| // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=399519 | ||
| @Test def testExtensionFeatureCallToStaticLocalFieldFromSuper() { | ||
| ''' | ||
| import java.util.Collections |
There was a problem hiding this comment.
Why did you change this test?
There was a problem hiding this comment.
The Collections is final in Java-25 and wasn't in Java-21 and before:
- https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Collections.html
- https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Collections.html
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ;)
There was a problem hiding this comment.
we have this problem on a regular base so i am fine with adjusting stuff while keeping the intent of the test
|
@HannesWell can you check what of this is missing on #3638 |
|
So your proposal is to close eyes on eg wizard not working properly on main |
Sorry for the simple question, but what wizard changes are you referring to exactly? But I'm happy to add the required wizard changes if you point me to them. |
8dc1f30 to
21bc1ae
Compare
|
The Jenkins changes are again tested with |
|
can you check the failing CliWizardIntegrationTest |
It was referencing a milestone MWE repository that was probably set during the release rampdown and that I copied at the time when I created this PR. That should be fixed now. But this is now blocked by |
|
Done |
- Add constants for Java-25 - Add compiler and wizard tests for Java-25. - Add Java-25 profile to xtext-dev BOM - Fix tests failing on Java-25: - java.util.Collections class is final in Java-25
|
Now all tests pass again and the Jenkins build looks also good: Do you have more more remarks or need more changes or is this ready? |

This adds only compiler support for Java-25, i.e. it becomes possible to compile projects that target Java-25.
This doesn't add UI support for it yet, but I can try to extend this PR if you want to have this one pass.
A dedicated Java-25 test project is also missing (like the one added for Java-21), but I can also look into that.
As far as I know now new relevant compiler constructs where added respectivly the Java standard library wasn't changed between Java-21 and 25 in a way that affects Xtext.
Java-17 support is maintained with this.
Part of
This also includes
I could do it without it, the latter but it would become more complex eventually.