maven-scm icon indicating copy to clipboard operation
maven-scm copied to clipboard

Use Generics in Command and derived classes

Open kwin opened this issue 5 months ago • 0 comments

New feature, improvement proposal

Currently the org.apache.maven.scm.command.Command interface does not leverage generics which leads to the fact that its execute methods just returns the generic ScmResult instead of the command specific result classes. This requires some casting in the code (e.g. in https://github.com/apache/maven-scm/blob/6fc20f710675bd78394633ecaab39a651e89b7cd/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/main/java/org/apache/maven/scm/provider/git/AbstractGitScmProvider.java#L170). Introducing a type variable for the return type of its execute method should allow to for more type-safe programming.

kwin avatar Jul 30 '25 14:07 kwin