-
Notifications
You must be signed in to change notification settings - Fork 538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[marshal methods] Properly support arrays of arrays #7707
Merged
Merged
Conversation
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
Fixes: dotnet#7693 Java code similar to: package com.xamarin.android; public interface DataListener { void onDataReceived ( java.lang.String fromNode, java.lang.String fromChannel, java.lang.String payloadType, byte[][] payload); } Generates Java JNI signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[[B)V which then would throw our marshal methods native assembly generator off, because it didn't expect that there might be consecutive `[` characters for parameters which are arrays of arrays (of any rank): System.InvalidOperationException: Unsupported JNI array type '[' at index 56 of signature '(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[[B)V' error XAGPM7009: at Xamarin.Android.Tasks.MarshalMethodsNativeAssemblyGenerator.<ParseJniSignature>g__JniTypeToManaged|55_0(Char jniType, <>c__DisplayClass55_0&) error XAGPM7009: at Xamarin.Android.Tasks.MarshalMethodsNativeAssemblyGenerator.ParseJniSignature(String signature, MethodDefinition implementedMethod) error XAGPM7009: at Xamarin.Android.Tasks.MarshalMethodsNativeAssemblyGenerator.ProcessAndAddMethod(List`1 allMethods, MarshalMethodEntry entry, Boolean useFullNativeSignature, Dictionary`2 seenClasses, Dictionary`2 overloadedNativeSymbolNames) error XAGPM7009: at Xamarin.Android.Tasks.MarshalMethodsNativeAssemblyGenerator.Init() error XAGPM7009: at Xamarin.Android.Tasks.GeneratePackageManagerJava.AddEnvironment() error XAGPM7009: at Xamarin.Android.Tasks.GeneratePackageManagerJava.RunTask() error XAGPM7009: at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 Fix this by skipping over the "extra" `[` characters. This generates code which uses a simple pointer to array, instead of a pointer to pointer etc. We can take this shortcut because we don't dereference the parameter in our generated code in any way, instead passing it as-is to the managed code.
* main: [ci] Pass token when building Designer tests (dotnet#7715) [Mono.Android] Android.Telecom.InCallService.SetAudioRoute() + enum (dotnet#7711) [Mono.Android] Fix some incorrect enums. (dotnet#7670) [Xamarin.Android.Build.Tasks] _Microsoft.Android.Resource.Designer namespace (dotnet#7681) LEGO: Merge pull request 7713 [Xamarin.Android.Build.Tasks] lazily populate Resource lookup (dotnet#7686)
grendello
added a commit
to grendello/xamarin-android
that referenced
this pull request
Jan 26, 2023
* main: (32 commits) [monodroid] Replace `exit()` with `abort()` in native code (dotnet#7734) Bump to xamarin/Java.Interop/main@8a1ae57 (dotnet#7738) [build] bump `$(AndroidNet7Version)` (dotnet#7737) Bump to xamarin/Java.Interop/main@1366d99 (dotnet#7718) [Xamarin.Android.Build.Tasks] fix AndroidGenerateResourceDesigner (dotnet#7721) Bump to xamarin/monodroid@50faac94 (dotnet#7725) Revert "[Xamarin.Android.Build.Tasks] fix cases of missing `@(Reference)` (dotnet#7642)" (dotnet#7726) [marshal methods] Properly support arrays of arrays (dotnet#7707) Bump to dotnet/installer@9962c6a 8.0.100-alpha.1.23063.11 (dotnet#7677) [Actions] Add action to bump the hash used for the unified pipeline (dotnet#7712) Bump to xamarin/xamarin-android-tools/main@099fd95 (dotnet#7709) [ci] Move build stages into yaml templates (dotnet#7553) [Xamarin.Android.Build.Tasks] fix NRE in `<GenerateResourceCaseMap/>` (dotnet#7716) [ci] Pass token when building Designer tests (dotnet#7715) [Mono.Android] Android.Telecom.InCallService.SetAudioRoute() + enum (dotnet#7711) [Mono.Android] Fix some incorrect enums. (dotnet#7670) [Xamarin.Android.Build.Tasks] _Microsoft.Android.Resource.Designer namespace (dotnet#7681) LEGO: Merge pull request 7713 [Xamarin.Android.Build.Tasks] lazily populate Resource lookup (dotnet#7686) [Xamarin.Android.Build.Tasks] skip XA1034 logic in some cases (dotnet#7680) ...
grendello
added a commit
to grendello/xamarin-android
that referenced
this pull request
Jan 30, 2023
* main: [marshal methods] Properly support arrays of arrays (dotnet#7707) Bump to dotnet/installer@9962c6a 8.0.100-alpha.1.23063.11 (dotnet#7677) [Actions] Add action to bump the hash used for the unified pipeline (dotnet#7712) Bump to xamarin/xamarin-android-tools/main@099fd95 (dotnet#7709) [ci] Move build stages into yaml templates (dotnet#7553) [Xamarin.Android.Build.Tasks] fix NRE in `<GenerateResourceCaseMap/>` (dotnet#7716) [ci] Pass token when building Designer tests (dotnet#7715)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes: #7693
Java code similar to:
Generates Java JNI signature:
which then would throw our marshal methods native assembly generator off, because it didn't expect that there might be consecutive
[
characters for parameters which are arrays of arrays (of any rank):Fix this by skipping over the "extra"
[
characters. This generates code which uses a simple pointer to array, instead of a pointer to pointer etc. We can take this shortcut because we don't dereference the parameter in our generated code in any way, instead passing it as-is to the managed code.