[AI Task] [Tizen.Pims.Calendar] Remove Convert.ChangeType boxing from CalendarRecord Get/Set - #7800
Open
JoonghyunCho wants to merge 1 commit into
Open
[AI Task] [Tizen.Pims.Calendar] Remove Convert.ChangeType boxing from CalendarRecord Get/Set#7800JoonghyunCho wants to merge 1 commit into
JoonghyunCho wants to merge 1 commit into
Conversation
Fixes #7710) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
Author
|
|
Member
Author
|
🤖 [AI Review] Reviewed — no findings. Scope checked:
No 🔴 critical issues, no 🟡 suggestions to flag. Automated review — final merge decision rests with human reviewers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the
Convert.ChangeType/Convert.To*conversion paths fromCalendarRecord.Get<T>(uint)andSet<T>(uint, T). Each branch already verifies the exact type viatypeof(T) == typeof(X), so the value is now converted with a direct cast ((T)(object)val) instead of going through the culture-awareIConvertibledispatch.Get<T>also drops the intermediateobject parsedValuelocal and returns directly from each branch.Per-call effect (e.g.
Get<int>): noConvert.ChangeTypecall, noIConvertiblevtable dispatch, noCultureInfolookup. ForGet<string>/Set<string>and theCalendarTimebranches the redundant conversion round-trip disappears entirely (reference-type cast).Get/Setrun once per record field, so iterating aCalendarListmultiplies the savings by (records x fields).This applies the identical pattern already approved for the sibling module in #7762 (
ContactsRecord, issue #7667).Changes
src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.csGet<T>: each type branch now ends withreturn (T)(object)val;; removed theobject parsedValuelocal, theConvert.ChangeTypecalls (5), and the trailing unboxreturn (T)parsedValue;. The unsupported-type branch still throwsNotSupportedas before.Set<T>:Convert.ToString/ToInt32/ToInt64/ToDoublereplaced with direct casts;Convert.ChangeTypein theCalendarTimebranch replaced with(CalendarTime)(object)value. The string branch usesvalue as string ?? string.Emptyto preserve the exact prior behavior ofConvert.ToString(object), which mapsnulltostring.Empty(so nativeSetStringstill receives an empty string, notnull).Mode
Refactoring
Verification
Public API signatures (
T Get<T>(uint),void Set<T>(uint, T)) are unchanged. Every direct cast is guarded by the exacttypeof(T)check, so noInvalidCastExceptionis reachable on paths that previously succeeded; normal-path results are bit-identical, includingGet<string>returningnullwhen the native value isNULLandConvert.ChangeType's same-type shortcut forCalendarTime(notIConvertible).Fixes #7710
🤖 Generated with Claude Code