RFR: 8370160: NumericShaper allows illegal ranges

Sergey Bylokhov serb at openjdk.org
Sat Oct 18 21:27:07 UTC 2025


On Sat, 18 Oct 2025 05:05:48 GMT, Phil Race <prr at openjdk.org> wrote:

> This is a follow-on to 8365077: java.awt.font.NumericShaper violates equals/hashCode contract
> 
> The factory method to construct a contextual shaper from a bitmask will happily store illegal, unspecified bits.
> So there are still ways to create instances which violate the contract.
> 
> This isn't possible with the enum approach. We should align these two. And we should document it.
> 
> Additionally the behaviour of eliminating an value which is of lesser precedence is also something we should specify.
> 
> CSR : https://bugs.openjdk.org/browse/JDK-8370161

src/java.desktop/share/classes/java/awt/font/NumericShaper.java line 1534:

> 1532:     private NumericShaper(int key, int mask) {
> 1533:         this.key = key;
> 1534:         this.mask = mask & (CONTEXTUAL_MASK | ALL_RANGES);

Note that this will accept the CONTEXTUAL_MASK even if it was provided by the app. It is unclear whether we should discard it in that case or not.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27884#discussion_r2442606464


More information about the client-libs-dev mailing list