Skip to content

Fix documentation errors in Java.Security.Spec (R118, pass 3) - #1996

Merged
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-review-java-security-spec-docs-r118
Nov 28, 2026
Merged

jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-review-java-security-spec-docs-r118

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 6ea984726f4017adb8662ae1763818cdd2704bc8

Dimension Assessment Rationale
Change confidence 9.5/10 ↑ Same wording as merged #1941 for Object-derived types.
↑ dotnet/android@9bc18c75 Object.cs:110-118 and JNIEnv.cs:360-393 show the peer copies the reference and transfer selects release and registration.
↑ 4 one-line edits; XML parses; git diff --check clean.
↓ 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 ojluni java/security/spec) and dotnet/android@9bc18c75.

Fixes

transfer parameter of the (IntPtr, JniHandleOwnership) constructor in EdDSAParameterSpec, NamedParameterSpec, XECPrivateKeySpec, XECPublicKeySpec:

  • Old: "Specifies whether ownership of the JNI reference transfers to this instance."
  • New: "Specifies how the runtime handles the JNI reference, including its release and peer registration."
  • Evidence: all 4 types derive from Java.Lang.Object. Object.SetHandle (Object.cs:110-118) constructs the peer with a copied reference, then calls JNIEnv.DeleteRef(value, transfer) (JNIEnv.cs:360-372); DoNotRegister maps to CopyAndDoNotRegister (JNIEnv.cs:388-393). The instance does not take ownership of the incoming reference.

Uncertain / out of scope (not changed)

  • ECFieldF2m(int, BigInteger) pre-AI IllegalArgumentException text says an invalid rp throws, but ECFieldF2m.java:91-96 only checks bit 0, bit m, and a bit count of 3 or 5. Pre-AI text; not changed.

Checks

  • Changed XML files parse; git diff --check clean; only the 4 transfer lines changed (CRLF and encoding preserved).
  • Rubber-duck review with gemini-4-argon (verified in local usage events, agent 752da429-c6b5-4439-95fc-d7a8b9e93b5c): no errors in the diff; one ledger citation corrected.

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>
Copilot AI balanced review requested due to automatic review settings November 28, 2026 17:32
@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) November 28, 2026 17:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 transfer controls 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

@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jonathanpeppers
jonathanpeppers merged commit 8f3cf4a into main Nov 28, 2026
4 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-review-java-security-spec-docs-r118 branch November 28, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants