Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
redirecting uses to new methods in registry
- Loading branch information
Stephan Fuhrmann
committed
Jul 4, 2014
1 parent
6f675b0
commit b1aa90f
Showing
1 changed file
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Was it really necessary to deprecate createOptionHandler(OptionDef o, Setter setter) method and not call it from
addArgument()
andaddOption()
methods? I understand the refactoring, done in 304dcb2. But this part of this change prevent developers from easily supplying their own instances of option and argument handlers.Note that in non trivial cases
OptionHandlerRegistry
machinery cannot be used. Why? Because IoC thing. When dependency injection framework is used, the custom option handlers must be part of the injection graph. Once this is the case ctors of option handlers can be passed much more arguments than the default ctor, and thus such instances cannot be created byOptionHandlerRegistry
and only can be created by derived class fromCmdLineParser
(using Google Guice assisted inject feature).But this change makes this behavior unnecessary complicated, because the overriding of
createOptionHandler()
doesn't have any effect any more andOptionHandlerRegistry
is used directly fromaddArgument()
andaddOption()
methods. The only way to supply home baked instances of handlers is now to override theaddArgument()
andaddOption()
methods, like suggested in this change: [1].But I think this is to much noise to do something that simple as supply custom created instances of option handlers. That why I think that this part of change has serious drawback for this specific use case, while giving us no advantage and should be reverted.
[1] https://gerrit-review.googlesource.com/67793