docs: add API differences from upstream Java reference - #439
Merged
Conversation
Consolidates the existing "Known Issues" bullets from csharp/README.md with newly-verified, concrete API-shape mismatches discovered while exercising the public API as a consumer would: PhoneNumberOfflineGeocoder / PhoneNumberToCarrierMapper taking this library's own Locale type instead of System.Globalization.CultureInfo, PhoneNumbers.Extensions.PhoneNumber colliding (CS0104) with PhoneNumbers.PhoneNumber when both namespaces are used together, enum members keeping Java's SCREAMING_SNAKE_CASE, and PhoneNumber's internal-setter/Builder shape looking like a settable POCO but failing to compile (CS0200) with an object initializer. Each entry was verified against current source and, where a compiler error is claimed, against an actual build. csharp/README.md's Known Issues section now links to the new page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WVGRJyQwtvBGXAmWswxyqW
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #439 +/- ##
=======================================
Coverage 87.26% 87.26%
=======================================
Files 41 41
Lines 3831 3831
Branches 978 978
=======================================
Hits 3343 3343
Misses 284 284
Partials 204 204 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wmundev
approved these changes
Aug 31, 2026
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.
Changes
docs/api-differences-from-java.md, a consolidated, scannable reference of places where this port's public API shape diverges from a literal Java-to-C# reading, or from what a C# developer would instinctively reach for. Each entry shows the Java shape, the C# shape, and why, and was verified against current source (several against an actualdotnet build).csharp/README.md(custom binary metadata format, binary geocoding/timezone/carrier maps,CharSequence→string) into the new page, and adds:PhoneNumberOfflineGeocoder.GetDescriptionForNumber/PhoneNumberToCarrierMapper.GetNameForNumbertake this library's ownPhoneNumbers.Localetype, notSystem.Globalization.CultureInfo— confirmed aCultureInfoargument fails withCS1503.PhoneNumbers.Extensions.PhoneNumber(the Extensions package's staticTryParse/TryParseValidhelper) shares its simple name withPhoneNumbers.PhoneNumber(the data type), producing a genuineCS0104ambiguous-reference error when both namespaces areusing'd together — confirmed by compiling a repro.PhoneNumberType,PhoneNumberFormat,ErrorType,MatchType,ValidationResult,Leniency,ShortNumberCost,CountryCodeSource) keep Java'sSCREAMING_SNAKE_CASEmember names rather than .NETPascalCase.PhoneNumber's public properties look like ordinary C# auto-properties but haveinternalsetters (it's a protobuf-style immutable message, same as Java) — an object initializer likenew PhoneNumber { CountryCode = 1 }fails withCS0200; construction goes throughPhoneNumberUtil.ParseorPhoneNumber.CreateBuilder()...Build().csharp/README.md's "Known Issues" section to keep the original three bullets in place (no link rot for existing readers) and link out to the new page for the fuller reference.Motivated by real mistakes made while exercising the library's public API as a consumer this session — the goal is to save the next contributor or consumer the same trial and error.
Test plan
CS1503forCultureInfo,CS0104for thePhoneNumbernaming collision,CS0200for thePhoneNumberobject initializer) by compiling a standalone repro project against this repo'sPhoneNumbers/PhoneNumbers.Extensionsprojects.LocaleinPhoneNumberOfflineGeocoder.cs, enum definitions,Phonenumber.csbuilder shape)..cs/.csproj/workflow files touched, so no build or test run is needed.