Commit 0140ab8
[Mono.Android] Make TypeManager a normal Java.Lang.Object (#1537)
Context: https://github.com/xamarin/xamarin-android/projects/1
The idea: use `jnimarshalmethod-gen.exe` to generate
*JNI Marshal Methods* at packaging time, so that we can avoid using
as much reflection for method registration, and *entirely avoid*
using `System.Reflection.Emit` for marshal method registration.
The problem: The Java type `mono.android.TypeManager` is Just Like
every other `Java.Lang.Object` C# subclass, in that it's a Java
`native` method that is registered with a C# delegate via
`JNIEnv.RegisterJniNatives()`.
*Unlike* every other `Java.Lang.Object` subclass, it wasn't actually
a `Java.Lang.Object` subclass. It Just Happened To Work because it
`JNIEnv.RegisterJniNatives()` used Reflection to find the
registration methods/etc., but it was otherwise "unique".
Being unique was fine, but in our desired new
`jnimarshalmethod-gen.exe` World Order™, being unique *isn't* fine;
it means it won't participate in packaging-time marshal method
generation, thus requiring use of `System.Reflection.Emit`, which
is undesirable.
Add a new internal `Java.Interop.TypeManager.JavaTypeManager` type to
use as the C# peer for `mono.android.TypeManager`, make
`TypeManager.JavaTypeManager` a normal `Java.Lang.Object` subclass,
then update `mono.android.TypeManager` to register
`Java.Interop.TypeManager+JavaTypeManager`. This removes the
"uniqueness" of `mono.android.TypeManager`, allowing it to be
processed normally by `jnimarshalmethod-gen.exe`.1 parent 648aff9 commit 0140ab8
File tree
2 files changed
+16
-1
lines changed- src/Mono.Android
- Java.Interop
- java/mono/android
2 files changed
+16
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
361 | 376 | | |
362 | 377 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
0 commit comments