Skip to content

Valhalla JEP 401 compatibility#194

Open
ericcaspole wants to merge 2 commits intoapache:masterfrom
ericcaspole:valhalla-jep401
Open

Valhalla JEP 401 compatibility#194
ericcaspole wants to merge 2 commits intoapache:masterfrom
ericcaspole:valhalla-jep401

Conversation

@ericcaspole
Copy link

This small change appears to bring xalan into compliance with JEP 390[1], which was a warning in preparation for JEP 401[2] by switching synchronized Integers to Objects, where the value of the Integer is never used, and this allows xalan dependent benchmarks, such as Dacapo xalan and fop, to run under builds of the Valhalla project[3] with --enable-preview.

[1] https://openjdk.org/jeps/390
[2] https://openjdk.org/jeps/401
[3] https://github.com/openjdk/valhalla

@Yqwed
Copy link

Yqwed commented Mar 16, 2026

@jkesselm Can you please take a look?

@jkesselm
Copy link
Contributor

Hmm.

This seems to be part of an effort to change some of the Java primitive classes, specifically Int, so they are compared strictly by value rather than object identity... removing the distinction between == and .equals().

I am not at all sold on that being a good decision. Among other things, as the semaphore shows, sweeping object identity under the carpet this way does not remove it. And I am nervous about how this will ripple through subclassing. It feels like a breaking change in exchange for minimal gain.

But apparently some systems are starting to issue deprecation warnings in preparation for it.

Given the number of other warnings in our code, and given that the warning appears to be ignorable in this case since we are using the object only as a semaphore anchor and never comparing it either way, I am a trifle skeptical about the need to make a change.

On the other hand, if we are using an object only as a semaphore anchor, we honestly don't care what its type is. We prefer something lightweight, but since there won't be many instances even that is non-critical.

I'd like to spend a bit more time actually staring at the proposed change rather than theory, but I am currently inclined to classify it as "at worst, harmless."

@Yqwed
Copy link

Yqwed commented Mar 16, 2026

On the other hand, if we are using an object only as a semaphore anchor, we honestly don't care what its type is.

Exactly. There is absolutely no reason to prefer new Integer(1) or new Boolean(true) over new Object() if it is used for synchronization only.

I am currently inclined to classify it as "at worst, harmless."

I'd disagree about harmless - as it is xalan can't be used in early access valhalla builds. Also OpenJDK team plans to make it a preview feature in JDK 27 (to be released this autumn) and xalan users will need to patch this library.

This change has zero risks and only helps Java ecosystem as a whole.

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.

3 participants