Skip to content

Comments

MBCS related changes for CLDR 48.0 update in JDK26#6904

Open
rishabh-ibm wants to merge 2 commits intoadoptium:v1.0.12-releasefrom
rishabh-ibm:release_JDK26_CLDRupdates
Open

MBCS related changes for CLDR 48.0 update in JDK26#6904
rishabh-ibm wants to merge 2 commits intoadoptium:v1.0.12-releasefrom
rishabh-ibm:release_JDK26_CLDRupdates

Conversation

@rishabh-ibm
Copy link
Contributor

Summary of MBCS Test Changes for JDK 26 Compatibility

This PR addresses three JDK 26 compatibility issues in MBCS tests caused by upstream API and data changes.


1. CharsetsTest - ArrayEncoder API Change

Problem:
JDK 26 removed sun.nio.cs.ArrayEncoder::encode method, breaking CharsetsTest.

Reference: JDK-8363925

API Changes:

Aspect JDK < 26 JDK 26+
Method encode() encodeFromUTF16()
Input char[] UTF-16 LE byte[]
Signature encode(char[], int, int, byte[]) encodeFromUTF16(byte[], int, int, byte[], int)

Solution:
Added JavaVersion utility for runtime version detection. Tests now use appropriate API based on JDK version.

Files:

  • Modified: functional/MBCS_Tests/charsets/src/CharsetsTest.java
  • Created: functional/MBCS_Tests/charsets/src/JavaVersion.java

2. Language Tag Tests - CLDR 48.0 Display Format

Problem:
CLDR 48.0 changed locale display format from capitalized to lowercase with colons.

Changes:

  • JDK ≤ 25: "First Day of Week Is Monday"
  • JDK ≥ 26: "First day of week: Monday"

Files Modified:

  • functional/MBCS_Tests/language_tag/src/CNTagTest.java
  • functional/MBCS_Tests/language_tag/src/USTagTest.java
  • functional/MBCS_Tests/language_tag/src/JPTagTest.java
  • functional/MBCS_Tests/language_tag/src/KRTagTest.java
  • functional/MBCS_Tests/language_tag/src/TWTagTest.java

Reference: CLDR 48.0


3. i18n zh_TW DateFormat - CLDR 48.0 Pattern Changes

Problem:
CLDR 48.0 changed zh_TW date format patterns, causing DateFormatTest failures.

Pattern Changes:

Format Before After
FULL y年M月d日 EEEE ah:mm:ss [zzzz] y年M月d日 EEEEah:mm:ss '['zzzz']'
LONG y年M月d日 ah:mm:ss [z] y年M月d日ah:mm:ss '['z']'
MEDIUM y年M月d日 ah:mm:ss y年M月d日ah:mm:ss
SHORT y/M/d ah:mm y/M/dah:mm

Key Changes:

  • Removed space between date and time
  • Added quotes around brackets for literal characters

Files:

  • Modified: functional/MBCS_Tests/i18n/src/DateFormatTest.java
  • Modified: functional/MBCS_Tests/i18n/src/ResourceBundleTest_zh_TW.java
  • Created: functional/MBCS_Tests/i18n/src/ResourceBundleTest_26_zh_TW.java

References:


Test Results

JDK 26:

  • CharsetsTest: PASS
  • Language Tag Tests: PASS (50/50)
  • i18n zh_TW: PASS

JDK 21:

  • CharsetsTest: PASS
  • Language Tag Tests: PASS (50/50)
  • i18n zh_TW: PASS

Summary

Files Modified: 10
Files Created: 3
Backward Compatible: Yes
All Tests Pass: JDK 21 and JDK 26

Signed-off-by: Rishabh Thakur rishabh@ibm.com

1. JDK 26 removed the unused `sun.nio.cs.ArrayEncoder::encode` method as
part of cleanup, causing CharsetsTest to fail.

**JDK-8363925: Remove unused sun.nio.cs.ArrayEncoder::encode**
🔗 https://bugs.openjdk.org/browse/JDK-8363925

| Aspect | JDK < 26 (Old API) | JDK 26+ (New API) |
|--------|-------------------|-------------------|
| **Method** | `encode()` | `encodeFromUTF16()` |
| **Input Type** | `char[]` array | UTF-16 LE `byte[]` array |
| **Signature** | `encode(char[] src, int srcOff, int srcLen, byte[]
dst)` | `encodeFromUTF16(byte[] src, int srcOff, int srcLen, byte[] dst,
int dstOff)` |
| **Parameters** | 4 parameters | 5 parameters (added dstOff) |

The old `encode(char[])` method was unused in the JDK codebase and was
removed as part of code cleanup. The new `encodeFromUTF16(byte[])`
method provides better performance and more control over encoding by
working directly with UTF-16 encoded bytes.

Version detection utility to determine JDK feature version at runtime.

```java
public static long getFeature() {
    return feature;  // Returns 21, 26, etc.
}

2. CLDR 48.0 changed the SeparateKeyValue display format from
capitalized phrases to lowercase with colon separators.

Changes:

Updated expected display format in 5 test files
JDK25 and below: "First Day of Week Is Monday"
JDK26 and above: "First day of week: Monday"
References:

JDK-8354550 - Update CLDR to Version 48.0
CLDR 48.0 Release: https://cldr.unicode.org/index/downloads/cldr-48

3. fixes the `DateFormatTest` failure for zh_TW locale caused by CLDR
48.0 format changes in JDK 26.

**Root Cause:**
CLDR 48.0 changed the date-time format patterns for Chinese (Taiwan)
locale, specifically:
1. Removed the space between date and time components
2. Changed bracket notation to use single quotes for literal characters

**Changes Made:**
Updated `ResourceBundleTest_zh_TW.java` with corrected date format
patterns:

| Format | Old Pattern | New Pattern (CLDR 48.0) |
|--------|-------------|-------------------------|
| FULL | `y年M月d日 EEEE ah:mm:ss [zzzz]` | `y年M月d日 EEEEah:mm:ss
'['zzzz']'` |
| LONG | `y年M月d日 ah:mm:ss [z]` | `y年M月d日ah:mm:ss '['z']'` |
| MEDIUM | `y年M月d日 ah:mm:ss` | `y年M月d日ah:mm:ss` |
| SHORT | `y/M/d ah:mm` | `y/M/dah:mm` |

**Testing:**
✅ Verified with JDK 26 - DateFormatTest now passes with "OK" status for
zh_TW locale

**References:**
- JDK-8354550 - Update CLDR to Version 48.0
- CLDR 48.0 Release: https://cldr.unicode.org/index/downloads/cldr-48
- CLDR Date/Time Patterns:
https://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns

Signed-off-by: Rishabh Thakur <rishabh@ibm.com>
@rishabh-ibm
Copy link
Contributor Author

@JasonFengJ9 @pshipton ,

This is the related PR for release branch. Please assign, approve and merge it.
Thanks,
@rishabh-ibm , @psawant19

Updated better logging mechanism in CharsetsTest class.

Signed-off-by: Rishabh Thakur <rishabh@ibm.com>
@pshipton
Copy link
Member

The change should not first be merged to the v1.0.12-release branch. It should be first merged to master and then the same change ported to the v1.0.12-release branch.

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