public boolean addMemoryValue()

in src/main/java/org/apache/maven/plugin/compiler/Options.java [272:302]


    public boolean addMemoryValue(String option, String label, String value, boolean addDefaultUnit) {
        value = strip(value);
        if (value != null) {
            int length = value.length();
            for (int i = 0; i < length; i++) {
                char c = value.charAt(i);
                if (c < '0' || c > '9') { // Do no use `isDigit(…)` because we do not accept other languages.
                    if (i == length - 1) {
                        c = Character.toUpperCase(c);
                        if (c == 'K' || c == 'M' || c == 'G') {
                            addDefaultUnit = false;
                            break;
                        }
                    }
                    logger.warn("Invalid value for " + label + "=\"" + value + "\". Ignoring this option.");
                    return false;
                }
            }
            if (addDefaultUnit) {
                value += 'M'; // Upper case because this is the correct case in International System of Units.
                logger.warn("Value " + label + "=\"" + value + "\" has been specified without unit. "
                        + "An explicit \"M\" unit symbol should be appended for avoiding ambiguity.");
            }
            option += value;
            if (checkNumberOfArguments(option, 0, true)) {
                options.add(option);
                return true;
            }
        }
        return false;
    }