Repository navigation
Fix documentation errors in Java.Security.Spec (R118, pass 3) - #1996
Conversation
Java.Lang.Object makes its own peer reference; transfer selects release of the incoming reference and peer registration (dotnet/android@9bc18c75 Object.cs:110-118, JNIEnv.cs:360-393). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the JNI-handle constructor documentation clarification.
No open issues 🎉
What changed in this PR
Corrects JNI-handle constructor documentation for four Java.Security.Spec types, aligning it with Java.Lang.Object reference handling and the wording established in #1941.
Changes:
- Clarifies that
transfercontrols JNI reference release and peer registration, rather than transferring the incoming reference to the instance. - Updates documentation only; API signatures and runtime behavior are unchanged.
| File | Description |
|---|---|
| docs/xml/Java.Security.Spec/XECPublicKeySpec.xml | Corrects the constructor’s transfer parameter description. |
| docs/xml/Java.Security.Spec/XECPrivateKeySpec.xml | Corrects the constructor’s transfer parameter description. |
| docs/xml/Java.Security.Spec/NamedParameterSpec.xml | Corrects the constructor’s transfer parameter description. |
| docs/xml/Java.Security.Spec/EdDSAParameterSpec.xml | Corrects the constructor’s transfer parameter description. |
Review effort: Balanced
|
@dalexsoto review |
dalexsoto
left a comment
There was a problem hiding this comment.
Reviewed at 6ea98472 (target 7396604e, merge base 5274e7b6).
The four transfer parameter edits are accurate. In dotnet/android 37.2.31 (c6663f24; Object.cs and JNIEnv.cs are blob-identical to the cited 9bc18c75), the generated protected (IntPtr, JniHandleOwnership) constructors chain to Java.Lang.Object(IntPtr, JniHandleOwnership) → SetHandle (Object.cs:35-39, 110-119). SetHandle constructs the peer with Copy, or CopyAndDoNotRegister when DoNotRegister is set (JNIEnv.cs:388-393). It then releases the incoming reference according to TransferLocalRef/TransferGlobalRef (JNIEnv.cs:360-372). The instance never adopts the incoming reference, so the old 'ownership transfers to this instance' text was wrong and the new release/registration wording is correct.
No other Java.Security.Spec file still has the old wording. The three target commits since the merge base don't touch this namespace. All four files parse, and OpenPublishing.Build and PoliCheck passed. No blocking issues.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
6ea984726f4017adb8662ae1763818cdd2704bc8↑ dotnet/android@9bc18c75 Object.cs:110-118 and JNIEnv.cs:360-393 show the peer copies the reference and
transferselects release and registration.↑ 4 one-line edits; XML parses;
git diff --checkclean.↓ OpenPublishing.Build result pending.
Scope
Pass-3 review of item R118: 33 files in
docs/xml/Java.Security.Spec. Diff checked:86f7744a1..origin/main. 222 AI-changed channels; 164 generated binding channels (JniPeerMembers,ThresholdClass,ThresholdType,UnregisterFromRuntime) deferred by scope; 58 in-scope channels, all 58 reviewed by hand against pinned sources.Pinned sources: Android SDK
source-37.2_r01(libcore ojlunijava/security/spec) and dotnet/android@9bc18c75.Fixes
transferparameter of the(IntPtr, JniHandleOwnership)constructor inEdDSAParameterSpec,NamedParameterSpec,XECPrivateKeySpec,XECPublicKeySpec:Java.Lang.Object.Object.SetHandle(Object.cs:110-118) constructs the peer with a copied reference, then callsJNIEnv.DeleteRef(value, transfer)(JNIEnv.cs:360-372);DoNotRegistermaps toCopyAndDoNotRegister(JNIEnv.cs:388-393). The instance does not take ownership of the incoming reference.Uncertain / out of scope (not changed)
ECFieldF2m(int, BigInteger)pre-AIIllegalArgumentExceptiontext says an invalidrpthrows, but ECFieldF2m.java:91-96 only checks bit 0, bitm, and a bit count of 3 or 5. Pre-AI text; not changed.Checks
git diff --checkclean; only the 4transferlines changed (CRLF and encoding preserved).gemini-4-argon(verified in local usage events, agent752da429-c6b5-4439-95fc-d7a8b9e93b5c): no errors in the diff; one ledger citation corrected.