Commit ece14c8
authored
Enable nullable reference types in AndroidDiskInformation.cs (#11813)
`src/Mono.AndroidTools/AndroidDiskInformation.cs` ships in the signed `Mono.AndroidTools` assembly but was nullable-oblivious. This opts the file into nullable reference types for compile-time null-safety with no runtime or API change.
### Changes
- Added `#nullable enable` to the top of the file.
- Changed the `s` locals in `ParseNewFormat` and `ParseOldFormat` from `string` to `string?`, matching `StringReader.ReadLine()`'s `string?` return. Flow analysis already narrows `s` to non-null inside the `while ((s = reader.ReadLine ()) != null)` bodies.
```csharp
string? s;
var reader = new StringReader (output);
while ((s = reader.ReadLine ()) != null) {
// s is non-null here
}
```
Annotation-only: no `!` operator, no `ArgumentNullException.ThrowIfNull` (the project targets `netstandard2.0`), and public signatures (`FromDfOutput`, `InternalSpace`, `ExternalSpace`) are unchanged.1 parent 3341169 commit ece14c8
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | | - | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
98 | | - | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
0 commit comments