[JNIEnv] Support sbyte jagged arrays#12115
Draft
simonrozsival wants to merge 2 commits into
Draft
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0e043be9-9070-43bc-aea4-a48438690bdf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0e043be9-9070-43bc-aea4-a48438690bdf
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
sbyteconverters beside the existingbyteconverters used by sharedJNIEnvarray creation, copying, reading, and element accesssbyte[]as JNI byte-array storage bit-for-bit, so negative managed values retain their two's-complement byte representation[Bfallback routing mapped to managedbyte, avoiding any canonicalization of existingbyterequests tosbyteThis affects generic and non-generic
JNIEnv.NewArray,JNIEnv.GetArray, andJNIEnv.CopyArraypaths, including recursive jagged-array handling.Experiment evidence
Both legacy and trimmable typemap experiments produced the expected JNI signatures (
[[Band[[[B) forsbytejagged arrays. Creation then failed during recursive leaf conversion with:The signatures were therefore already correct; the shared converter dictionaries omitted
sbytewhile containingbyte.Tests
Added on-device regression coverage for generic and non-generic
NewArray/GetArray/CopyArrayat ranks 1, 2, and 3:sbyte: minimum, negative, zero, and maximum valuesbyte: values with high bits set, confirming existing unsigned managed behavior remains unchanged[B,[[B, and[[[BValidation:
dotnet build src/Mono.Android/Mono.Android.csproj --no-restore ...— passed (15 existing warnings)