Skip to content

[Group 1] Enable nullable annotations for Microsoft.Extensions.FileSystemGlobbing#57398

Merged
eerhardt merged 25 commits into
dotnet:mainfrom
maxkoshevoi:mk/43605-FileSystemGlobbing
Oct 6, 2021
Merged

[Group 1] Enable nullable annotations for Microsoft.Extensions.FileSystemGlobbing#57398
eerhardt merged 25 commits into
dotnet:mainfrom
maxkoshevoi:mk/43605-FileSystemGlobbing

Conversation

@maxkoshevoi

@maxkoshevoi maxkoshevoi commented Aug 14, 2021

Copy link
Copy Markdown
Contributor

Related to #43605

Questions:

  • Implementations of DirectoryInfoBase differ in nullability for GetDirectory and GetFile. So marked both of them as nullable in interface. Issue is that interface documentation says that they shouldn't be null.

Issue to fix nullability issues: #58211

@ghost

ghost commented Aug 14, 2021

Copy link
Copy Markdown

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost ghost added area-Extensions-FileSystem new-api-needs-documentation community-contribution Indicates that the PR has been added by a community member labels Aug 14, 2021
@ghost

ghost commented Aug 14, 2021

Copy link
Copy Markdown

Tagging subscribers to this area: @maryamariyan, @dotnet/area-extensions-filesystem
See info in area-owners.md if you want to be subscribed.

Issue Details

Related to #43605

Questions:

  • Implementations of DirectoryInfoBase differ in nullability for GetDirectory and GetFile. So marked both of them as nullable in interface. Issue is that interface documentation says that they shouldn't be null.
Author: maxkoshevoi
Assignees: -
Labels:

new-api-needs-documentation, area-Extensions-FileSystem

Milestone: -

@maxkoshevoi maxkoshevoi changed the title Enable nullable annotations for Microsoft.Extensions.FileSystemGlobbing [Group 1] Enable nullable annotations for Microsoft.Extensions.FileSystemGlobbing Aug 15, 2021
@adamsitnik adamsitnik added this to the 7.0.0 milestone Aug 16, 2021
if (segment is RecursiveWildcardSegment)
{
if (segmentsPatternStartsWith == null)
if (segmentsPatternStartsWith == null || segmentsPatternEndsWith == null || segmentsPatternContains == null)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should be changing behavior here.

}

if (segmentsPatternStartsWith == null)
if (segmentsPatternStartsWith == null || segmentsPatternEndsWith == null || segmentsPatternContains == null)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should be changing behavior here. We will probably need to annotate RaggedPattern to allow for null segmentsPatternEndsWith and segmentsPatternContains, if they can't be proven to not be null here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are initialized together, so only one of them is checked (if one is null - all of them are and vise versa). Compiler just doesn't know that.
I've added those checks just to let compiler know that other two lists are also not null.

Replaced additional checks with !

# Conflicts:
#	src/libraries/Microsoft.Extensions.FileSystemGlobbing/ref/Microsoft.Extensions.FileSystemGlobbing.csproj
#	src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/Microsoft.Extensions.FileSystemGlobbing.csproj

@krwq krwq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with 2 comments

@eerhardt

eerhardt commented Oct 4, 2021

Copy link
Copy Markdown
Member

@krwq @maxkoshevoi - is this PR ready to be merged? Or are there more changes needed?

@maxkoshevoi

Copy link
Copy Markdown
Contributor Author

All good from my side

@krwq

krwq commented Oct 5, 2021

Copy link
Copy Markdown
Member

@maxkoshevoi sorry for late re-review. The comment about hash is still valid, I've responded

@maxkoshevoi

Copy link
Copy Markdown
Contributor Author

@krwq @eerhardt Removed the test. PR can be merged now.

@eerhardt eerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had one last comment. After that is addressed I think we can merge this.

@maxkoshevoi

Copy link
Copy Markdown
Contributor Author

@eerhardt resolved the comment

@eerhardt

eerhardt commented Oct 6, 2021

Copy link
Copy Markdown
Member

Test failure is unrelated. #60088

@eerhardt
eerhardt merged commit 1c30027 into dotnet:main Oct 6, 2021
@maxkoshevoi
maxkoshevoi deleted the mk/43605-FileSystemGlobbing branch October 6, 2021 21:29
@ghost ghost locked as resolved and limited conversation to collaborators Nov 6, 2021
@jeffhandley jeffhandley linked an issue Aug 9, 2022 that may be closed by this pull request
2 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Extensions-FileSystem community-contribution Indicates that the PR has been added by a community member new-api-needs-documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove ! from Microsoft.Extensions.FileSystemGlobbing

4 participants