Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support constructor binding on 3rd party classes #18935

Closed
philwebb opened this issue Nov 7, 2019 · 2 comments
Closed

Support constructor binding on 3rd party classes #18935

philwebb opened this issue Nov 7, 2019 · 2 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@philwebb
Copy link
Member

philwebb commented Nov 7, 2019

We currently don't offer a good way to indicate that constructor binding should be used on a class that isn't under the users own control. See #18919 (comment) for details.

@philwebb
Copy link
Member Author

philwebb commented Nov 8, 2019

We've discussed changing the logic again so that a @ConstructorBinding on a type indicates that any nested bind is also a candidate for constructor binding. To offer an escape hatch where constructor binding should not be used we could offer an exclude attribute.

@philwebb philwebb removed the for: team-attention An issue we'd like other members of the team to review label Nov 8, 2019
@philwebb philwebb added this to the 2.2.x milestone Nov 8, 2019
@mbhave mbhave self-assigned this Nov 8, 2019
@mbhave
Copy link
Contributor

mbhave commented Nov 13, 2019

It's not clear when someone would want to use exclude. Adding exclude would more often than not mean that setter binding should be attempted in which case a default constructor is required. Once there's a default constructor along with a parameterized constructor, constructor binding is automatically skipped because it checks for the presence of exactly one constructor that is parameterized. The exclude then does not provide any additional benefit. For this reason, we've decided not to rush into adding the exclude attribute till there is a solid use-case for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants