airlift / airline

Java annotation-based framework for parsing Git like command line structures
Apache License 2.0
846 stars 141 forks source link

Add @SafeVarargs annotation to Cli.java #54

Closed jesboat closed 6 years ago

jesboat commented 6 years ago

Summary:

Cli.CliBuilder and Cli.GroupBuilder have

public CliBuilder<C> withCommands(Class<? extends C> command, Class<? extends C>... moreCommands);

public GroupBuilder<C> withCommands(Class<? extends C> command, Class<? extends C>... moreCommands)

Both of them use the moreCommands array in a typesafe way, which means they could be annotated with @SafeVarargs. They were not, though, which generates unchecked warnings at call sites.

Note that the methods must be made final for SafeVarargs to be valid.

A description of SafeVarargs is https://docs.oracle.com/javase/specs/jls/se8/html/jls-9.html#jls-9.6.4.7

Test plan: mvn clean verify passes on 8u141

jesboat commented 6 years ago

@dain @electrum @martint

electrum commented 6 years ago

Merged, thanks!