cbeust / jcommander

Command line parsing framework for Java
Apache License 2.0
1.96k stars 334 forks source link

Updating from 1.7.2 to 1.7.8 breaks #483

Open SElab2019 opened 4 years ago

SElab2019 commented 4 years ago

When I try to upgrade jcommander from 1.7.2 to 1.7.8. The following code breaks.

public class Main {

    static
    public void main(String... args) throws Exception {
        Main main = new Main();

        JCommander commander = new JCommander(main);
        commander.setProgramName(Main.class.getName());

        try {
            commander.parse(args);
        } catch(ParameterException pe){
            StringBuilder sb = new StringBuilder();

            sb.append(pe.toString());
            sb.append("\n");

            commander.usage(sb);

            System.err.println(sb.toString());

            System.exit(-1);
        }
    }
}

The code should pass, but it throws an error:

Main.java:[36,34] method usage in class com.beust.jcommander.JCommander cannot be applied to given types;