Skip to content

Upgrade to Java 21 - #44

Open
rodinaarssen wants to merge 2 commits into
mainfrom
upgrade-jdk21
Open

rodinaarssen wants to merge 2 commits into
mainfrom
upgrade-jdk21

Conversation

@rodinaarssen

Copy link
Copy Markdown
Member

No description provided.

@DavyLandman

DavyLandman commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

@msteindorfer are you okay with moving capsule into JDK21?

@DavyLandman
DavyLandman marked this pull request as ready for review October 27, 2026 10:57
@msteindorfer

Copy link
Copy Markdown
Member

(Note, I've seen usethesource/usethesource.github.io#27 flying by, but not followed the detailed discussion over time.)

What's the Capsule-specific rationale for updating to JDK 21, for both runtime (e.g., on CI/CD builds) and increasing the byte-code release target as well?

The former I support unconditionally. I would even suggest to move to the latest LTS, JDK 25. Regarding raising the byte-code level, I'd like to hear what benefit you're expecting at the moment?


In general, I was considering to move towards a JEP 14: The Tip & Tail Model of Library Development inspired model, where the tails are more conservative for backwards compatibility, whereas tip move more progressively. That said, I haven't mapped out the specifics yet.

@DavyLandman

Copy link
Copy Markdown
Member

What's the Capsule-specific rationale for updating to JDK 21, for both runtime (e.g., on CI/CD builds) and increasing the byte-code release target as well?

The former I support unconditionally. I would even suggest to move to the latest LTS, JDK 25. Regarding raising the byte-code level, I'd like to hear what benefit you're expecting at the moment?

Runtime: we've always used the same runtime as the target level, but recently the backwards compatibility has really improved, so that could be reconsidered.

Byte code/language level: for upstream projects, (vallang & rascal) we have some language features and libraries that came after java 11 that we want to use. So since vallang & rascal won't be limited to jdk11, we thought, maybe capsule can also move to 21, such that new features such as records and some better ways to calculate field offsets might be used?

If instead you're aware of other capsule users that would be impacted by raising the class level to java 21, I think we can instead choose to not upgrade this now, and perhaps only run the the newer runtime but leave the language level at 11.

In general, I was considering to move towards a JEP 14: The Tip & Tail Model of Library Development inspired model, where the tails are more conservative for backwards compatibility, whereas tip move more progressively. That said, I haven't mapped out the specifics yet.

Hmm, that is an interesting discussion indeed, especially with regards to semver.

@jurgenvinju

Copy link
Copy Markdown
Member

In general the benefit of moving the target/runtime level to 21 is because we are forced to in the Rascal project in order to keep up with dependencies and their security patches.

Specifically for capsule we'd like it then for consistency with the rest: diagnostics and predictability of runtime behavior (such as efficiency). It's hard to keep up expertise for different levels at the same time. And it's easy to forget while focusing on some challenge.

Nevertheless if more libraries would have done as proposed we would not have been forced to go in this direction now. So I'm very open to this discussion.

@jurgenvinju

Copy link
Copy Markdown
Member

We also have a general rule at usethesource to keep all projects at the same levels, but that can be discussed as well.

@DavyLandman

Copy link
Copy Markdown
Member

So as keeping capsule at java 11 does not limit us in vallang & rascal to upgrade to java 21, I think we can choose to skip the forced upgrade of the language level.

Maybe a way to interpret the use the source java language level is that it's a maximum? So a project may choose a lower language level if it makes it more compatible with other users of the library. And at a later point might still decide to also go for a higher level of java, in case new changes require it. But that it can not go above the agreed-upon language level of the use the source projects.

@msteindorfer

Copy link
Copy Markdown
Member

Byte code/language level: for upstream projects, (vallang & rascal) we have some language features and libraries that came after java 11 that we want to use. So since vallang & rascal won't be limited to jdk11, we thought, maybe capsule can also move to 21, such that new features such as records and some better ways to calculate field offsets might be used?

There are definitely interesting features for Capsule that come with newer Java versions, like records, sealed classes, pattern matching for switch, and value objects. Hence, a baseline upgrade will happen, in some shape or form, eventually.

If instead you're aware of other capsule users that would be impacted by raising the class level to java 21, I think we can instead choose to not upgrade this now, and perhaps only run the the newer runtime but leave the language level at 11.

I second that. The rationale for not upgrading Capsule to --release 21 right now is about compatibility with other projects, beyond the usethesource organisation. Furthermore, I want to integrate some longer-standing pending work items before considering making a cut in terms of compatibility.

In any case, I recommend adopting newer Java runtime release, regardless of the target bytecode level.

So as keeping capsule at java 11 does not limit us in vallang & rascal to upgrade to java 21, I think we can choose to skip the forced upgrade of the language level.

Indeed you're not blocked on independently upgrading source level or release target for rascal or vallang.

And at a later point might still decide to also go for a higher level of java, in case new changes require it. But that it can not go above the agreed-upon language level of the use the source projects.

The upper bound, is a practical way to view it.

On the topic of agreed-upon-level and not going above it, my point of view is more differentiated, hence I brought up the tip-and-tail model. I can foresee that we keep a stable maintenance line say of the 0.7.x branch around that remains compatible with Java 11. (Or maybe even introduce a Java 21 maintenance line at one point in time.) At the same time I can see value in creating a tip version that leverages the latest features (like value objects a.k.a. project Valhalla) and target a feature release / rework aligned with Java 29 (LTS). The latter wouldn't likely be adopted by other usethesource projects right away, but at your own timeline you can decide when you're ready to switch from the maintenance line to the latest and greatest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants