Skip to content

[vendored] RRConfig.h should mark the error parameter on mutators as nullable — current NS_ASSUME_NONNULL_BEGIN forces a false invariant #1188

Description

@dariusta

Source

Filed from a downstream consumer (Straton-Labs-LLC/stratton-internal, vendoring WebDriverAgentLib.xcframework).
Tracking ID in our audit: ocr-prelim-06896.

Affected file

WebDriverAgentLib/RodmanRunnerLib/RRConfig.h (vendored header at native/runner/Frameworks/WebDriverAgentLib.xcframework/ios-arm64/RodmanRunnerLib.framework/Headers/RRConfig.h)

Defect

The file is wrapped in NS_ASSUME_NONNULL_BEGIN ... NS_ASSUME_NONNULL_END. Every pointer parameter in that region inherits nonnull. The relevant mutator:

+ (BOOL)setScreenshotOrientation:(NSString *)orientation error:(NSError **)error;

Under the NS_ASSUME_NONNULL_BEGIN region the error parameter is NSError * _Nonnull * _Nonnull, i.e. callers must pass a non-null pointer to an NSError * slot.

That is the opposite of the standard Cocoa "pass NULL if you don't care about the error" idiom. Apple's own convention (and every other Foundation API that uses NSError **) is the opposite: NSError * _Nullable * _Nullable.

Consumers that follow the standard idiom (i.e. [RRConfig setScreenshotOrientation:@"auto" error:NULL]) will get a nullability-completeness warning under -Wnullability-completeness, and downstream projects compiling with -Werror will fail to build.

Suggested fix

Mark the error parameter explicitly nullable at the parameter level:

+ (BOOL)setScreenshotOrientation:(NSString *)orientation
                           error:(NSError * _Nullable * _Nullable)error;

and audit every other mutator in this header for the same pattern (this is the only one that returns BOOL/NSError **, but worth checking valueFromArguments:forKey: too, which returns _Nullable already — good — but is inside the same NS_ASSUME_NONNULL_BEGIN block).

If the project standardizes on NS_SWIFT_CALL/NS_REFINED_FOR_SWIFT, also re-export these as Swift throws so the awkward NSError ** indirection is hidden from Swift callers.

Why this matters downstream

A vendored framework that violates the standard Cocoa nullability convention forces every downstream to either patch the header or disable -Wnullability-completeness (silently losing real diagnostics).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions