Skip to content

Navigation Menu

Sign in
Sign up

Replace ICU4J UCharacter methods with standard Java Character class - #118

Merged
sideshowbarker merged 1 commit into
master from
ICU4J-UCharacter-replace-with-standard-Java-Character
May 12, 2026
Merged

Replace ICU4J UCharacter methods with standard Java Character class #118
sideshowbarker merged 1 commit into
master from
ICU4J-UCharacter-replace-with-standard-Java-Character

Conversation

@sideshowbarker

@sideshowbarker sideshowbarker commented May 12, 2026
edited
Loading

Copy link
Copy Markdown
Member

ICU4J 75.1 removed the char-taking overloads of UCharacter methods:

  • isHighSurrogate(char) — removed (only isHighSurrogate(int) remains)
  • isLowSurrogate(char) — removed (only isLowSurrogate(int) remains)
  • getCodePoint(char, char) — removed (only getCodePoint(int, int) remains)

When code compiled against an older ICU4J (which had those methods) runs with ICU4J 75.1, it throws NoSuchMethodError — because the bytecode contains direct references to the removed method signatures.

Note: Code compiled against ICU4J 75.1 happens to work because Java’s implicit widening conversion (char → int) binds to the int versions at compile time. But that doesn’t help users of pre-compiled artifacts.

This change replaces all uses of those ICU4J methods with equivalent methods from Java’s standard Character class (available since Java 5):

  • UCharacter.isHighSurrogate(c) → Character.isHighSurrogate(c)
  • UCharacter.isLowSurrogate(c) → Character.isLowSurrogate(c)
  • UCharacter.getCodePoint(c1, c2) → Character.toCodePoint(c1, c2)

ICU4J 75.1 removed the char-taking overloads of UCharacter methods:
- isHighSurrogate(char) — removed (only isHighSurrogate(int) remains)
- isLowSurrogate(char) — removed (only isLowSurrogate(int) remains)
- getCodePoint(char, char) — removed (only getCodePoint(int, int) remains)
When code compiled against an older ICU4J (which had those methods) runs
with ICU4J 75.1, it throws NoSuchMethodError — because the bytecode
contains direct references to the removed method signatures.
Note: Code compiled against ICU4J 75.1 happens to work because Java’s
implicit widening conversion (char → int) binds to the int versions
at compile time. But that doesn’t help users of pre-compiled artifacts.
This change replaces all uses of those ICU4J methods with equivalent
methods from Java’s standard Character class (available since Java 5):
- UCharacter.isHighSurrogate(c) → Character.isHighSurrogate(c)
- UCharacter.isLowSurrogate(c) → Character.isLowSurrogate(c)
- UCharacter.getCodePoint(c1, c2) → Character.toCodePoint(c1, c2)
sideshowbarker force-pushed the ICU4J-UCharacter-replace-with-standard-Java-Character branch from 919b5fb to 6699f5c Compare May 12, 2026 08:10

@hsivonen hsivonen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

sideshowbarker merged commit 0015376 into master May 12, 2026
12 checks passed
sideshowbarker deleted the ICU4J-UCharacter-replace-with-standard-Java-Character branch May 12, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hsivonen hsivonen hsivonen approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /