Skip to content

Commit ada2c72

Browse files
authored
[Mono.AndroidTools] Enable nullable reference types in AdbSyncNotification.cs (#11778)
`AdbSyncNotification.cs` ships in `Mono.AndroidTools.dll` but compiled in a nullable-oblivious context. This opts the file into NRT, making its existing null contract explicit: `LocalPath` is `null` for directory/remove/preserve operations, while `RemotePath` is always non-null. ## Changes - **`src/Mono.AndroidTools/Adb/AdbSyncNotification.cs`** - Added `#nullable enable` as the first line. - Annotated `LocalPath` property and the `localPath` constructor parameter as `string?`; `RemotePath` stays non-nullable. ```csharp public AdbSyncNotification (AdbSyncKind kind, string remotePath, string? localPath, long size) ... public string? LocalPath { get; private set; } ``` No null-throwing is required (`netstandard2.0`, so no `ArgumentNullException.ThrowIfNull`), and callers in `AdbSyncContext.cs`, `AdbSyncClient.cs`, and `AndroidDevice.cs` are not nullable-enabled, so no call-site changes or warnings result.
1 parent 07ab367 commit ada2c72

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/Mono.AndroidTools/Adb/AdbSyncNotification.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#nullable enable
12
//
23
// AdbSyncNotification.cs
34
//
@@ -33,7 +34,7 @@ namespace Mono.AndroidTools.Adb
3334
/// </summary>
3435
public class AdbSyncNotification
3536
{
36-
public AdbSyncNotification (AdbSyncKind kind, string remotePath, string localPath, long size)
37+
public AdbSyncNotification (AdbSyncKind kind, string remotePath, string? localPath, long size)
3738
{
3839
this.Kind = kind;
3940
this.RemotePath = remotePath;
@@ -43,7 +44,7 @@ public AdbSyncNotification (AdbSyncKind kind, string remotePath, string localPat
4344

4445
public AdbSyncKind Kind { get; private set; }
4546
public string RemotePath { get; private set; }
46-
public string LocalPath { get; private set; }
47+
public string? LocalPath { get; private set; }
4748
public long Size { get; private set; }
4849

4950
public string GetMessage ()

0 commit comments

Comments
 (0)