feat: Generic type blacklisting and enhance blacklist checks in Reflector#61
Merged
Conversation
…hecks in Reflector
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enhances the blacklisting mechanism in the Reflector class to support generic type definition blacklisting. When a generic type definition (e.g., List<>) is blacklisted, all its closed constructed types (e.g., List<int>, List<string>) are automatically considered blacklisted as well.
Changes:
- Added logic to check if a generic type's definition is blacklisted in the
IsTypeBlacklistedInternalmethod - Added comprehensive unit tests covering various scenarios of generic type definition blacklisting
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ReflectorNet/src/Reflector/Reflector.Registry.cs | Added generic type definition check to blacklist all closed constructed types when their generic definition is blacklisted |
| ReflectorNet.Tests/src/ReflectorTests/IsTypeBlacklistedTests.cs | Added 13 new test cases covering generic type definition blacklisting scenarios including closed generics, nested generics, arrays, and .NET-specific generic types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Test Results 2 files 2 suites 8m 7s ⏱️ Results for commit 1d38854. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds comprehensive tests for generic type blacklisting and extends the blacklisting logic in the
Reflectorclass to support blacklisting generic type definitions. This ensures that when a generic type definition (likeList<>) is blacklisted, all its closed constructed types (such asList<int>,List<string>, etc.) are also considered blacklisted. The changes also cover nested generics, arrays of generics, and .NET-specific types likeSpan<>andReadOnlySpan<>.Generic Type Blacklisting Enhancements
Reflector.Registry.csto check if a generic type's definition is blacklisted, ensuring that blacklisting a generic type definition (e.g.,List<>) will blacklist all its closed constructed types (e.g.,List<int>,List<string>) as well.Expanded Unit Test Coverage
IsTypeBlacklistedTests.csfor generic type definition blacklisting, including tests for blacklisting closed generic types, generic type definitions, nested generics, custom generic wrappers, arrays of generics, and .NET-specific generic types likeSpan<>andReadOnlySpan<>.