Skip to content

[fix-finder] Add XML documentation to JValue struct #11353

@github-actions

Description

@github-actions

Problem

The JValue struct in Android.Runtime has no XML documentation comments on any of its public members. This struct is a fundamental JNI interop type used when passing arguments to Java methods from C#, and developers working with low-level JNI calls need clear documentation to understand each constructor's purpose and its mapping to Java/JNI primitive types.

Location

  • File: src/Mono.Android/Android.Runtime/JValue.cs
  • Lines: All public members (lines 7–81)

Current Code

The file has a public struct with 9 constructors and 1 static field, all completely undocumented:

[StructLayout(LayoutKind.Explicit)]
public struct JValue {
    public static JValue Zero = new JValue (IntPtr.Zero);
    public JValue (bool value) { ... }
    public JValue (sbyte value) { ... }
    public JValue (char value) { ... }
    public JValue (short value) { ... }
    public JValue (int value) { ... }
    public JValue (long value) { ... }
    public JValue (float value) { ... }
    public JValue (double value) { ... }
    public JValue (IntPtr value) { ... }
    public JValue (IJavaObject value) { ... }
}

Suggested Fix

Add /// XML documentation comments to every public member. Each constructor should describe which JNI/Java type it corresponds to. Example:

/// <summary>
/// Represents a JNI <c>jvalue</c> union, used to pass arguments to Java methods
/// via JNI function calls.
/// </summary>
/// <remarks>
/// <para>
/// Each constructor corresponds to one of the JNI primitive types or an object reference.
/// See the <see href="(docs.oracle.com/redacted) Type Specification</see>.
/// </para>
/// </remarks>
[StructLayout(LayoutKind.Explicit)]
public struct JValue {

    /// <summary>
    /// A <see cref="JValue"/> representing a JNI <c>NULL</c> object reference.
    /// </summary>
    public static JValue Zero = new JValue (IntPtr.Zero);

    /// <summary>
    /// Creates a <see cref="JValue"/> from a <see cref="bool"/> value,
    /// corresponding to the JNI <c>jboolean</c> type.
    /// </summary>
    /// <param name="value">The Boolean value.</param>
    public JValue (bool value) { ... }

    /// <summary>
    /// Creates a <see cref="JValue"/> from an <see cref="sbyte"/> value,
    /// corresponding to the JNI <c>jbyte</c> type.
    /// </summary>
    /// <param name="value">The signed byte value.</param>
    public JValue (sbyte value) { ... }

    // ... similar for char→jchar, short→jshort, int→jint, long→jlong,
    //     float→jfloat, double→jdouble, IntPtr→jobject, IJavaObject→jobject
}

Guidelines

  • Use /// XML doc comments (not // or /* */)
  • Include <summary>, <param>, and <remarks> tags as appropriate
  • Reference the corresponding JNI type name using <c> tags (e.g., <c>jboolean</c>)
  • Follow the repo's Mono formatting style: tabs for indentation, space before (
  • Link to the JNI type specification in the struct-level <remarks>
  • The IJavaObject constructor should note it extracts the Handle and passes IntPtr.Zero for null
  • Do not modify any code logic — only add XML doc comments

Acceptance Criteria

  • All 10 public members of JValue have /// XML documentation comments
  • The struct itself has a <summary> and <remarks> explaining its purpose
  • Each constructor documents which JNI type it corresponds to
  • Each constructor has a <param> tag for its parameter
  • All tests pass
  • No new warnings introduced

Note

🔒 Integrity filter blocked 4 items

The following items were blocked because they don't meet the GitHub integrity level.

  • #10534 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #5352 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #4662 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #5728 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Nightly Fix Finder for issue #11352 · ● 2M ·

  • expires on May 21, 2026, 9:19 PM UTC

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions