forked from dotnet/android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump to dotnet/java-interop@7a058c0e (dotnet#9066)
Fixes: dotnet#9038 Changes: dotnet/java-interop@ccafbe6...7a058c0 * dotnet/java-interop@7a058c0e: [Java.Interop] Add `IJavaPeerable.JavaAs()` extension method (dotnet/java-interop#1234) * dotnet/java-interop@6f9defa5: Bump to dotnet/android-tools@3debf8e0 (dotnet/java-interop#1236) * dotnet/java-interop@6923fb89: [ci] Add dependabot branches to build triggers (dotnet/java-interop#1233) * dotnet/java-interop@573028f3: [ci] Use macOS 13 Ventura build agents (dotnet/java-interop#1235) dotnet/java-interop@7a058c0e adds a new `IJavaPeerable.JavaAs<T>()` extension method, to perform type casts which return `null` when the cast will not succeed instead of throwing an exception. Update `AndroidValueManager.CreatePeer()` to check for Java-side type compatibility (by way of `TypeManager.CreateInstance()`). Previously, this would not throw: var instance = … var r = instance.PeerReference; var wrap_instance = JniRuntime.CurrentRuntime.ValueManager.CreatePeer ( reference: ref r, options: JniObjectReferenceOptions.Copy, targetType: typeof (SomeInterfaceThatInstanceDoesNotImplement)); // `wrap_instance` is not null, `.CreatePeer()` does not throw wrap_instance.SomeMethod(); // will throw, due to a type mismatch. `AndroidValueManager.CreatePeer()` will now return `null` if the Java instance referenced by the `reference:` parameter is not convertible to `targetType`, as per [`JNIEnv::IsAssignableFrom()`][0]. [0]: https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/functions.html#IsAssignableFrom
- Loading branch information
Showing
4 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
Submodule Java.Interop
updated
14 files
This file contains 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
This file contains 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
This file contains 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