dotnet / dotnet/android

[TrimmableTypeMap] Revisit delayed registerNatives mechanism for Application and Instrumentation subclasses

Open
#11,194 0 comments 0 reactions 0 assignees View on GitHub
needs-triage trimmable-type-map
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 21h
Merged PRs (30d)
257

Description

Application and Instrumentation java classes are loaded before the .NET runtime is initialized. This means we can't use `static { ... }` to register native methods and we implemented 2 separate ways of working around this:
- `ApplicationRegistration.java` - generated code which we can call manually from JNIEnvInit and where we can register native methods for all the types that need it (very few usually)
- lazy call to `registerNatives` from the generated java constructors of the Application and Instrumentation subclasses (and also from static methods)

We should settle on just one approach and simplify the generator code. I suggest removing the `ApplicationRegistration` class and only use the lazy registration just before the first `native` method is called.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.