Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICU-22407 Implement Java Temporal Calendar API #2526

Merged
merged 1 commit into from
Jul 29, 2023

Conversation

FrankYFTang
Copy link
Contributor

Checklist
  • Required: Issue filed: https://unicode-org.atlassian.net/browse/ICU-22407
  • Required: The PR title must be prefixed with a JIRA Issue number.
  • Required: The PR description must include the link to the Jira Issue, for example by completing the URL in the first checklist item
  • Required: Each commit message must be prefixed with a JIRA Issue number.
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable

@FrankYFTang FrankYFTang added incomplete Needs work; do not approve/merge as is. api Adds or changes public API. labels Jul 10, 2023
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4j/main/classes/core/src/com/ibm/icu/util/Calendar.java is different
  • icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/CalendarRegressionTest.java is different
  • icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/TemporalMonthCodeTest.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4j/main/classes/core/src/com/ibm/icu/impl/CalType.java is now changed in the branch
  • icu4j/main/classes/core/src/com/ibm/icu/util/Calendar.java is different
  • icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/OrdinalMonthTest.java is now changed in the branch
  • icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/TemporalMonthCodeTest.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@jira-pull-request-webhook
Copy link

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang FrankYFTang changed the title (incomplete) ICU-22407 Implement Java Temporal Calendar API ICU-22407 Implement Java Temporal Calendar API Jul 27, 2023
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/InTemporalLeapYearTest.java is different
  • icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/TemporalMonthCodeTest.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@jira-pull-request-webhook
Copy link

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang FrankYFTang removed the incomplete Needs work; do not approve/merge as is. label Jul 28, 2023
@FrankYFTang
Copy link
Contributor Author

Since richgillam reviewed #2274 it probably would be easier for him to be the reviewer since it is a 1:1 porting from the C++ implementation

richgillam
richgillam previously approved these changes Jul 28, 2023
Copy link
Contributor

@richgillam richgillam left a comment

Choose a reason for hiding this comment

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

I probably should have read this more closely, but I'm running out of brain cells...

This looks good, and it looks like what I remember from the C side.

@@ -777,7 +777,7 @@ int32_t HebrewCalendar::internalGetMonth() const {
HebrewCalendar *nonConstThis = (HebrewCalendar*)this; // cast away const

int32_t year = nonConstThis->handleGetExtendedYear();
return ordinalMonth + ((isLeapYear(year) && (ordinalMonth > ADAR_1)) ? 1: 0);
return ordinalMonth + (((!isLeapYear(year)) && (ordinalMonth > ADAR_1)) ? 1: 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

I take it the lack of ! was a bug, but is the extra pair of parentheses buying you anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just make it more explicit that the ! is not applying to A&&B but only to A

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and the cpp part is already merged in other PR and removed from this PR

* @draft ICU 74
*/
public String getTemporalMonthCode() {
if (get(MONTH) == 12) return "M13";
Copy link
Contributor

Choose a reason for hiding this comment

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

Dumb question, but why isn't "M13" listed in gTemporalMonthCodes above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, the gTemporalMonthCodes should not be here.

@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4c/source/i18n/calendar.cpp is no longer changed in the branch
  • icu4c/source/i18n/hebrwcal.cpp is no longer changed in the branch
  • icu4c/source/test/intltest/caltest.cpp is no longer changed in the branch
  • icu4j/main/classes/core/src/com/ibm/icu/impl/CalType.java is no longer changed in the branch
  • icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/CalendarRegressionTest.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang
Copy link
Contributor Author

PTAL

Copy link
Contributor

@richgillam richgillam left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for the fixes!

@jira-pull-request-webhook
Copy link

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang FrankYFTang merged commit d511cad into unicode-org:main Jul 29, 2023
101 checks passed
@FrankYFTang FrankYFTang deleted the ICU-22407-try3 branch July 29, 2023 01:17
@FrankYFTang
Copy link
Contributor Author

Have post-merge breakage on the following three tests

Testcase: TestConsistencyChinese took 10.636 sec
FAILED
Round trip conversion produces different time from Mon Feb 17 18:06:15 PST 1890 to Wed Feb 27 18:06:15 PST 1889 delta: -30672000000 Gregorian(e=1 1890/2/18)
junit.framework.AssertionFailedError: Round trip conversion produces different time from Mon Feb 17 18:06:15 PST 1890 to Wed Feb 27 18:06:15 PST 1889 delta: -30672000000 Gregorian(e=1 1890/2/18)
at com.ibm.icu.dev.test.AbstractTestLog.errln(AbstractTestLog.java:50)
at com.ibm.icu.dev.test.calendar.IBMCalendarTest.checkConsistency(IBMCalendarTest.java:2162)
at com.ibm.icu.dev.test.calendar.IBMCalendarTest.TestConsistencyChinese(IBMCalendarTest.java:2077)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Testcase: TestConsistencyDangi took 9.44 sec
FAILED
Round trip conversion produces different time from Mon Feb 17 18:06:29 PST 1890 to Wed Feb 27 18:06:29 PST 1889 delta: -30672000000 Gregorian(e=1 1890/2/18)
junit.framework.AssertionFailedError: Round trip conversion produces different time from Mon Feb 17 18:06:29 PST 1890 to Wed Feb 27 18:06:29 PST 1889 delta: -30672000000 Gregorian(e=1 1890/2/18)
at com.ibm.icu.dev.test.AbstractTestLog.errln(AbstractTestLog.java:50)
at com.ibm.icu.dev.test.calendar.IBMCalendarTest.checkConsistency(IBMCalendarTest.java:2162)
at com.ibm.icu.dev.test.calendar.IBMCalendarTest.TestConsistencyDangi(IBMCalendarTest.java:2082)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Testcase: TestConsistencyIndian took 1.273 sec
FAILED
Round trip conversion produces different time from Fri Apr 26 18:06:44 PST 4713 to Fri May 03 18:06:44 PST 4713 delta: 604800000 Gregorian(e=0 4713/4/27)
junit.framework.AssertionFailedError: Round trip conversion produces different time from Fri Apr 26 18:06:44 PST 4713 to Fri May 03 18:06:44 PST 4713 delta: 604800000 Gregorian(e=0 4713/4/27)
at com.ibm.icu.dev.test.AbstractTestLog.errln(AbstractTestLog.java:50)
at com.ibm.icu.dev.test.calendar.IBMCalendarTest.checkConsistency(IBMCalendarTest.java:2162)
at com.ibm.icu.dev.test.calendar.IBMCalendarTest.TestConsistencyIndian(IBMCalendarTest.java:2027)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

@FrankYFTang
Copy link
Contributor Author

The post merge breakage are the same as the C++ one in https://unicode-org.atlassian.net/browse/ICU-22252
Will work oon a new PR for Java based on #2298 to address this soon

catamorphism pushed a commit to catamorphism/icu that referenced this pull request Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Adds or changes public API. waiting-on-reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants