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-22994 Remove misuage of Calendar::getType #3310

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FrankYFTang
Copy link
Contributor

@FrankYFTang FrankYFTang commented Dec 18, 2024

Use getDynamicClassID and getStaticClassID for calendar type comparision instead of strcmp.
Hide some Hebrew adjustment by using rencently added Calendar API.

dynamic_cast will not work because dynamic_cast(superclass) will not return nullptr for a subclass. For example, ISO8601Calendar is a subclass of GregorianCalendar
and if we have a cal, which could be either a GregorianCalendar or ISO8601Calendar, we cannot depend on dynamic_cast<GregorianCalendar*>(cal) != nullptr to check getType will return “gregorian”

Checklist

  • Required: Issue filed: ICU-22994
  • Required: The PR title must be prefixed with a JIRA Issue number. Example: "ICU-1234 Fix xyz"
  • 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. Example: "ICU-1234 Fix xyz"
  • 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 force-pushed the ICU-22994-FixCalendarGetType branch from 2fb4782 to 53bbf05 Compare December 19, 2024 00:55
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4c/source/i18n/datefmt.cpp is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

Use getDynamicClassID and getStaticClassID for calendar type comparision
instead of strcmp.
Hide some Hebrew adjustment by using rencently added Calendar API.
@FrankYFTang FrankYFTang force-pushed the ICU-22994-FixCalendarGetType branch from 53bbf05 to 8f48ddf Compare December 19, 2024 00:58
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4c/source/i18n/smpdtfmt.cpp is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

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.

1 participant