Ulf,

I actually prefer the current way, a separate implementation of the process method for each option rather than having a single big switch on enum constants. I wrote my implementation of the handleOptions method (the previous version is copied from JavapTask) [1]. That also addresses the bug you found when an empty parameter is passed to the last option. I'm happy with this version and hope you are.

As for the -R vs -r option, '-r' was initially used as "--reverse" which is gone now and I could use it. I prefer not to make change in the interface for the initial push as I am waiting for CCC approval (I believe the process we have about compatibility). I expect the jdeps tool will evolve after getting feedback. I'll look at that together with other potential enhancements after the initial push.

Happy Holidays and Happy New Year!
Mandy

[1] http://cr.openjdk.java.net/~mchung/jdk8/webrevs/jdeps/webrev.07/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java.html

On 12/21/2012 4:19 AM, Ulf wrote:
A little more verbose (as member of class JDepsTask):

enum Option {
    VERBOSE (false, "-v", "--verbose"),
    PACKAGE (true, "-p", "--package"),
    ...;
    private boolean hasParam;
    private String[] aliases;
    private Option (boolean hasParam, String aliases...) {
        ...;
    }
    process (String form, String param) {
        If (hasParam &&
(param == null || param.length == 0 || param.charAt(0) == '-'))
            throw new BadArgs("err.missing.arg", form).showUsage(true);
        switch (this) {
            case VERBOSE : verbose = Verbose.VERBOSE; break;
            case PACKAGE : packageNames.add(param); break;
            ...
        }
    }
}


-Ulf

Reply via email to