Fix nullable annotations in *Operations#74
Fix nullable annotations in *Operations#74campersau wants to merge 2 commits intotestcontainers:mainfrom
Conversation
HofmeisterAn
left a comment
There was a problem hiding this comment.
Thanks for the PR. I have two quick questions.
Some operation interfaces still use ... CancellationToken cancellationToken);. Probably something we should align too?
| } | ||
|
|
||
| public Task CreateImageAsync(ImagesCreateParameters parameters, Stream imageStream, AuthConfig authConfig, IDictionary<string, string> headers, IProgress<JSONMessage> progress, CancellationToken cancellationToken = default(CancellationToken)) | ||
| public Task CreateImageAsync(ImagesCreateParameters parameters, Stream? imageStream, AuthConfig authConfig, IDictionary<string, string>? headers, IProgress<JSONMessage> progress, CancellationToken cancellationToken = default) |
There was a problem hiding this comment.
I haven't checked all of them, but it seems the interface sometimes uses different signatures (nullable) compared to the implementation. The interface looks like this (see imageStream, headers):
Task CreateImageAsync(ImagesCreateParameters parameters, Stream imageStream, AuthConfig authConfig, IDictionary<string, string> headers, IProgress<JSONMessage> progress, CancellationToken cancellationToken = default);There was a problem hiding this comment.
Yes, I have made some arguments nullable in the implementation (since they can be) to avoid nullable warnings.
The implementation can actually allow null even though it is not defined in the interface.
If you want I can mark all arguments nullable when they can actually be null in the implementation.
There was a problem hiding this comment.
If you want I can mark all arguments nullable when they can actually be null in the implementation.
That's probably the cleanest approach. WDYT?
1504220 to
209db97
Compare
I have fixed them. There were just 3 in the interfaces and two of them are actually obsolete. |
|
Also some interfaces are implemented explicitly and others are not. If you want I can also make them consistent (either way). |
If we change it, it would be great to align and make it consistent (as long as it's not too much work). I don't think there's a need to implement them explicitly? |
Some parameters can be
nulllikeso the parameters should be marked as nullable
Also replaced
default(CancellationToken)withdefaultfor consistency.Changes only affect *Operations interfaces / classes.