# HG changeset patch # User Doug Simon # Date 1403899868 -7200 # Node ID 56cd93afdc15a5d4f779cfaa89662bd9ac16e686 # Parent e589c26c2eb89659681a68539f4f55277ec8e743 better error message when mistaking a boolean option for a non-boolean option or vice versa diff -r e589c26c2eb8 -r 56cd93afdc15 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java Fri Jun 27 22:10:23 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java Fri Jun 27 22:11:08 2014 +0200 @@ -202,13 +202,22 @@ } protected static void printNoMatchMessage(String optionName) { - System.err.println("Could not find option " + optionName + " (use -G:+PrintFlags to see Graal options)"); - List matches = fuzzyMatch(optionName); - if (!matches.isEmpty()) { - System.err.println("Did you mean one of the following?"); - for (OptionDescriptor match : matches) { - boolean isBoolean = match.getType() == boolean.class || match.getType() == Boolean.class; - System.err.println(String.format(" %s%s%s", isBoolean ? "(+/-)" : "", match.getName(), isBoolean ? "" : "=")); + OptionDescriptor desc = options.get(optionName); + if (desc != null) { + if (desc.getType() == Boolean.class) { + System.err.println("Boolean option " + optionName + " must be prefixed with '+' or '-'"); + } else { + System.err.println(desc.getType().getSimpleName() + " option " + optionName + " must not be prefixed with '+' or '-'"); + } + } else { + System.err.println("Could not find option " + optionName + " (use -G:+PrintFlags to see Graal options)"); + List matches = fuzzyMatch(optionName); + if (!matches.isEmpty()) { + System.err.println("Did you mean one of the following?"); + for (OptionDescriptor match : matches) { + boolean isBoolean = match.getType() == Boolean.class; + System.err.println(String.format(" %s%s%s", isBoolean ? "(+/-)" : "", match.getName(), isBoolean ? "" : "=")); + } } } }