Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement generic support for all generic types that have zero or one constraint#34

Open
Nilzor wants to merge 3 commits intoBedrockStreaming:mainfrom
Nilzor:main
Open

Implement generic support for all generic types that have zero or one constraint#34
Nilzor wants to merge 3 commits intoBedrockStreaming:mainfrom
Nilzor:main

Conversation

Copy link

Nilzor commented Dec 11, 2025

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

  • MyType
  • MyType
  • MyType where T: Exception
  • MyType
  • MyType

Example of unsupported types

Any types with two or more constraints, like:

  • MyType where 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant