Skip to content

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

@remkop

Description

@remkop

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions