Skip to content

Add CDC text formatting APIs - #183

Merged
dlunch merged 3 commits into
mainfrom
agent/cdc-text-formatting
Jul 19, 2026
Merged

Add CDC text formatting APIs#183
dlunch merged 3 commits into
mainfrom
agent/cdc-text-formatting

Conversation

@dlunch

@dlunch dlunch commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add the CDC java.text core hierarchy: Format, DateFormat, SimpleDateFormat, NumberFormat, and DecimalFormat.
  • Add FieldPosition, ParsePosition, and ParseException, plus runtime class registration.
  • Extend Calendar with timezone and leniency behavior needed by date formatting.
  • Cover formatting, parsing, factories, patterns, cloning, and error positions with standard-library tests.

Compatibility scope

This targets practical CDC application compatibility with English/US symbols and GMT or raw-offset time zones. Localized symbol resource classes, localized patterns, scientific notation, a full timezone database, and full lenient date normalization remain out of scope.

Validation

  • cargo fmt --all -- --check
  • cargo clippy -p java_runtime --tests -- -D warnings
  • cargo test -p java_runtime (187 passed)
  • cargo test --workspace (229 passed, 1 ignored)
  • git diff --check

Copilot AI review requested due to automatic review settings July 18, 2026 10:51
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.44057% with 420 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.50%. Comparing base (f87e410) to head (84bf15c).

Files with missing lines Patch % Lines
java_runtime/src/classes/java/text/date_format.rs 76.28% 125 Missing ⚠️
...untime/src/classes/java/text/simple_date_format.rs 78.11% 102 Missing ⚠️
...ava_runtime/src/classes/java/text/number_format.rs 81.33% 95 Missing ⚠️
...va_runtime/src/classes/java/text/decimal_format.rs 87.04% 61 Missing ⚠️
...va_runtime/src/classes/java/text/parse_position.rs 79.03% 13 Missing ⚠️
...va_runtime/src/classes/java/text/field_position.rs 84.00% 12 Missing ⚠️
java_runtime/src/classes/java/text/format.rs 87.64% 11 Missing ⚠️
java_runtime/src/classes/java/util/calendar.rs 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #183      +/-   ##
==========================================
- Coverage   87.09%   86.50%   -0.59%     
==========================================
  Files         199      207       +8     
  Lines       17962    20224    +2262     
==========================================
+ Hits        15644    17495    +1851     
- Misses       2318     2729     +411     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a minimal java.text formatting/parsing stack to java_runtime to improve CDC application compatibility, including core Format/DateFormat/NumberFormat hierarchies, supporting position/exception types, and the Calendar behaviors needed for date formatting.

Changes:

  • Introduces java.text runtime classes: Format, DateFormat/SimpleDateFormat, NumberFormat/DecimalFormat, plus FieldPosition, ParsePosition, and ParseException.
  • Registers the new runtime classes and extends java.util.Calendar with timezone + leniency behavior needed by the formatters.
  • Adds standard-library tests covering factories, formatting/parsing, patterns/quoting, cloning, and error/field positions.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
java_runtime/tests/classes/java/text/test_number_format.rs Adds NumberFormat/DecimalFormat factory/format/parse and position tests.
java_runtime/tests/classes/java/text/test_format.rs Adds tests for common text hierarchy, positions, ParseException, and polymorphic Format methods.
java_runtime/tests/classes/java/text/test_date_format.rs Adds DateFormat/SimpleDateFormat formatting/parsing/timezone/clone tests.
java_runtime/tests/classes/java/text/mod.rs Wires new java.text test modules.
java_runtime/tests/classes/java/mod.rs Enables text tests from the Java test module root.
java_runtime/src/loader.rs Registers new java/text/* runtime class protos.
java_runtime/src/classes/java/util/calendar.rs Adds setTimeZone, isLenient, setLenient, and leniency participation in equals/hashCode.
java_runtime/src/classes/java/text/simple_date_format.rs Implements pattern tokenization plus formatting/parsing for a scoped set of SimpleDateFormat tokens.
java_runtime/src/classes/java/text/parse_position.rs Implements ParsePosition fields/accessors/equality/hash/toString.
java_runtime/src/classes/java/text/parse_exception.rs Implements ParseException with error offset storage.
java_runtime/src/classes/java/text/number_format.rs Implements NumberFormat factories, formatting dispatch, parsing helpers, and digit/grouping configuration.
java_runtime/src/classes/java/text/format.rs Implements base Format behavior: format(Object), parseObject(String), and clone.
java_runtime/src/classes/java/text/field_position.rs Implements FieldPosition fields/accessors/equality/hash/toString.
java_runtime/src/classes/java/text/decimal_format.rs Implements DecimalFormat pattern parsing, formatting, parsing, and multiplier support.
java_runtime/src/classes/java/text/date_format.rs Implements DateFormat factories, calendar/numberFormat plumbing, parsing/format helpers, and deep-ish clone behavior.
java_runtime/src/classes/java/text.rs Adds the java::text module and re-exports new classes.
java_runtime/src/classes/java.rs Exposes pub mod text from classes::java.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread java_runtime/src/classes/java/text/simple_date_format.rs Outdated
Comment thread java_runtime/src/classes/java/text/simple_date_format.rs Outdated
Comment thread java_runtime/src/classes/java/text/decimal_format.rs
Comment thread java_runtime/src/classes/java/text/decimal_format.rs
Comment thread java_runtime/src/classes/java/text/simple_date_format.rs Outdated
Comment thread java_runtime/src/classes/java/text/decimal_format.rs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bdf8ff24d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread java_runtime/src/classes/java/text/decimal_format.rs
Comment thread java_runtime/src/classes/java/text/decimal_format.rs Outdated
@dlunch
dlunch merged commit fd629c7 into main Jul 19, 2026
9 of 11 checks passed
@dlunch
dlunch deleted the agent/cdc-text-formatting branch July 19, 2026 00:39
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.

2 participants