Skip to content

[Java.Interop] Map nullable byte jagged arrays to java.lang.Byte#12113

Draft
simonrozsival wants to merge 2 commits into
dev/simonrozsival/android-trimmable-revisit-arrays-generic-collectionsfrom
dev/simonrozsival/fix-legacy-nullable-byte-arrays
Draft

[Java.Interop] Map nullable byte jagged arrays to java.lang.Byte#12113
simonrozsival wants to merge 2 commits into
dev/simonrozsival/android-trimmable-revisit-arrays-generic-collectionsfrom
dev/simonrozsival/fix-legacy-nullable-byte-arrays

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Summary

  • treat byte? as a managed-to-JNI signature alias of sbyte? for java/lang/Byte in the reflection type manager built-ins
  • preserve Java-to-managed canonicalization of java/lang/Byte as sbyte?
  • cover rank-2 and rank-3 nullable byte jagged arrays in legacy and trimmable type-manager/device tests

Experiment evidence

Before this change, legacy reverse signature lookup had no built-in entry for System.Byte?. Looking up byte?[][] or byte?[][][] therefore failed, and JNIEnv.NewArray() fell back to java.lang.Object[][] / java.lang.Object[][][]. The element values still round-tripped. The trimmable manager already returned the intended [[Ljava/lang/Byte; and [[[Ljava/lang/Byte; signatures.

Behavior change

Legacy byte? reverse lookup now shares the existing nullable signed-byte JNI signature, producing exact java.lang.Byte array classes at ranks 2 and 3. Primitive byte/sbyte behavior, Java-to-managed sbyte? canonicalization, and collection roots are unchanged.

Tests

  • dotnet test tests/Java.Interop-Tests/Java.Interop-Tests.csproj --filter FullyQualifiedName~JniTypeManagerTests (6 passed; supplied installed JDK paths)
  • added device coverage for exact rank-2/rank-3 JNI class names and managed value round-trips; device tests were not run locally

simonrozsival and others added 2 commits July 15, 2026 10:45
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
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