[jnimarshalmethod-gen] JavaInterop1 marshal methods #1164
Merged
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: #1159
Context: c93fea0
jnimarshalmethod-gen
is intended to generate marshal methods for any type that that:[JavaCallable]
(tested inJava.Interop.Export-Tests.dll
and c93fea0), orvirtual
method which has[JniMethodSignature]
, or[JniMethodSignature]
.Thus, the intention was that it should generate marshal methods for
Java.Base-Tests
:Notably missing? No messages stating:
Also missing?
ikdasm bin/TestDebug-net7.0/Java.Base-Tests.dll
showed that there were no__RegisterNativeMembers()
methods emitted.The
jnimarshalmethod-gen
invocation was a no-op!The problems were twofold:
It was only looking for methods with
Android.Runtime.RegisterAttribute
. This was useful for Xamarin.Android (when we were trying to make it work), but doesn't work with Java.Base. We need to also look forJava.Interop.JniMethodSignature
.Relatedly, the attempt to use
registerAttribute.Constructor.Parameters
to determine parameter names didn't work; the parameter name was always""
.A'la c93fea0, we need to ensure that the Java
native
methods we register are consistent withjcw-gen
output.Fix these two problems, which allows
jnimarshalmethod-gen
to now emit marshal methods for types withinJava.Base-Tests.dll
.Additionally, rework the
jnimarshalmethod-gen -f
logic to remove the existing__<$>_jni_marshal_methods
nested type when present.