Skip to content

Conversation

@copybara-service
Copy link

@copybara-service copybara-service bot commented Jun 12, 2024

Update J2ObjC Protocol Buffer builder method arguments to default to nonnull.

Java's Protocol Buffer builder implementation does not allow nullable method parameters. This change updates the J2ObjC implementation to match that behavior. Before this change, if a nil pointer was passed in as an argument to a builder method, the application would crash due to a NullPointerException.

These nullability annotations add an additional safeguard to ensure Swift optionals are properly unwrapped and Objective-C call-sites properly guard nil values.

@copybara-service copybara-service bot changed the title Update J2ObjC proto pointer arguments to be nonnull. Java's proto implementation does not allow nullable method parameters. This change updates the J2ObjC implementation to match this behavior. Before this change, if a nil value is passed in to a proto builder supplied by J2ObjC, the application will crash. Update J2ObjC proto builder pointer method parameters to be nonnull. Jun 12, 2024
@copybara-service copybara-service bot force-pushed the test_642600828 branch 3 times, most recently from a73185d to 99b4483 Compare June 18, 2024 19:58
@copybara-service copybara-service bot changed the title Update J2ObjC proto builder pointer method parameters to be nonnull. Update J2ObjC Protocol Buffer builder method arguments to default to nonnull. Jun 18, 2024
@copybara-service copybara-service bot force-pushed the test_642600828 branch 2 times, most recently from a5159e0 to 7656925 Compare June 18, 2024 22:01
…`nonnull`.

Java's Protocol Buffer builder implementation does not allow nullable method parameters. This change updates the J2ObjC implementation to match that behavior. Before this change, if a nil pointer was passed in as an argument to a builder method, the application would crash due to a `NullPointerException`.

These nullability annotations add an additional safeguard to ensure Swift optionals are properly unwrapped and Objective-C call-sites [properly guard](https://clang.llvm.org/docs/DiagnosticsReference.html#wnonnull) nil values.

PiperOrigin-RevId: 644525720
@copybara-service copybara-service bot merged commit bcfbe19 into master Jun 18, 2024
@copybara-service copybara-service bot deleted the test_642600828 branch June 18, 2024 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant