Skip to content

Commit 17b123b

Browse files
Clarify JNI assignability check
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 80aff30 commit 17b123b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/Mono.Android/Microsoft.Android.Runtime/TrimmableTypeMap.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@ internal bool TryGetJniNameForManagedType (Type managedType, [NotNullWhen (true)
377377
// Verify the Java object is actually assignable to the target Java type
378378
// before returning the fallback proxy. Without this, we'd create invalid peers
379379
// (e.g., IAppendableInvoker wrapping a java.lang.Integer).
380+
//
381+
// Note: JNI IsAssignableFrom uses (candidate, targetBase), which is the
382+
// reverse of the more familiar managed `targetBase.IsAssignableFrom (candidate)`.
380383
if (proxy is null || !self.TryGetJniNameForManagedType (targetType, out var targetJniName)) {
381384
return null;
382385
}

0 commit comments

Comments
 (0)