Skip to content
New issue

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

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

Already on GitHub? # to your account

BestMatchingConstructor#typesAreCompatible does type compatibility the opposite way #9

Closed
rahulpilani opened this issue Oct 8, 2017 · 5 comments

Comments

@rahulpilani
Copy link

rahulpilani commented Oct 8, 2017

On line 124 of BestMatchingConstructor.java, you have the following code:
if (!inputParamType.isAssignableFrom(constructorParamType)) { matches = false; break; }

Shouldn't this comparison be the other way? like so:
if (!constructorParamType.isAssignableFrom(inputParamType)) { matches = false; break; }
It's perfectly fine if the constructor param is a super class or an interface of the inputType, but the other way around will be a compile error. So the net effect of this is that only exact types are allowed, for which there is no work-around if the constructor param is an interface.

@rahulpilani
Copy link
Author

#10

@davidmarquis
Copy link
Owner

Thanks! Good catch! Merging to master... do you need this quickly? If yes I can release a new revision, otherwise I'll wait for the next release.

@rahulpilani
Copy link
Author

How far out is the next release? For now I am avoiding using it because of this issue, so I am not blocked.

@davidmarquis
Copy link
Owner

davidmarquis commented Oct 8, 2017

@rahulpilani
Copy link
Author

Awesome! thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants