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

Use generic return type from CommandLine::getCommand to avoid type cast #205

Closed
remkop opened this issue Oct 15, 2017 · 0 comments
Closed

Comments

@remkop
Copy link
Owner

remkop commented Oct 15, 2017

Currently client code needs to cast the return type of getCommand:

CommandLine commandLine = new CommandLine(new MyApp());
// ... do something

MyApp myApp = (MyApp) commandLine.getCommand();

The above cast adds no value.

This ticket proposes to change the return type of getCommand to a generic type, so client code can look like this instead:

CommandLine commandLine = new CommandLine(new MyApp());
MyApp myApp = commandLine.getCommand();

This is unusual but no more or less type safe than requiring client code to do a type cast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant