Closed Bug 1674224 Opened 4 years ago Closed 4 years ago

JNI annotation processor should generate hint comments to help developers determine native method signatures

Categories

(GeckoView :: General, task, P1)

Unspecified
All

Tracking

(firefox84 fixed)

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: bugzilla, Assigned: bugzilla)

Details

(Whiteboard: [geckoview:m84])

Attachments

(2 files)

When I first started working with our JNI stuff, one thing I noticed that increases difficulty is figuring out what a native method signature should actually be. This resulted in a bit of trial and error until I got something that built.

Our annotation processor already has an idea about what native method signatures should be; we just need to spit that information out as a comment that describes a sample signature for the developer-supplied native method(s).

I have some test patches, so I'll assign myself...

Priority: -- → P1
Whiteboard: [geckoview:m84]

This patch adds some code to our annotation processor that produces comments in
our generated JNI headers to help the developer understand which types are
involved. There are two new types of comments:

  • For generated methods from native to Java, we produce a simplified Java method
    signature (sans package names) to help the caller disambiguate parameter
    types. This is helpful since the machine-readable method signature tend to
    use mozilla::jni::Object::Param instead of actual types (for the purposes of
    avoiding dependency hell, presumably).
  • For Java to native methods, we produce a sample signature that is usable for
    the implementation of the native method.

While we did discuss some ideas about other locations where we could output this
data, I'd like to start with the generated header files for now. We can make
adjustments to the output location in future bugs.

I will be attaching an example of a generated header that contains these new
comments to the bug.

Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5e3ff421cf2a
Generate Java signature hints in JNI wrappers; r=geckoview-reviewers,agi
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: