-
Notifications
You must be signed in to change notification settings - Fork 9
Implement generic support for all generic types that have zero or one constraint#34
Open
Nilzor wants to merge 3 commits intoBedrockStreaming:mainfrom
Open
Implement generic support for all generic types that have zero or one constraint#34Nilzor wants to merge 3 commits intoBedrockStreaming:mainfrom
Nilzor wants to merge 3 commits intoBedrockStreaming:mainfrom
Conversation
Solves issue #32 .
I have implemented support for basic generics for constructor- and member injection. It has been briefly tested in a fairly complex project with a lot of generic usage. It support any number of generic type parameters for the class that needs a factory or member-injector, as long as none of the generic types have more than one type constraint. (To support this one would probably need to rewrite the interface toothpick.Factory in Toothpick.)
The changes are backwards compatible as proved by the unchanged unit tests - only new are added.
Examples of supported generics
MyTypeMyTypeMyTypewhere T: Exception MyTypeMyType
Example of unsupported types
Any types with two or more constraints, like:
MyTypewhere T: Exception, T: Serializable
Niclas Halvorsen
and others
added 3 commits
December 11, 2025 17:31
... constraint
Multiple generic type parameters is supported, e.g. MyType.
a
Multiple constraints, e.g. MyType where T: Exception, T: Serializable, is not supported
Multiple generic type parameters is supported, e.g. MyType
a
Multiple constraints, e.g. MyType
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.