Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8073989

Deprecated integer options are considered as invalid instead of deprecated in Java 9



    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:



        After fixing JDK-8060449 Java 9 consider deprecated integer options as invalid.

        For example, if we run Java 8 with "-XX:MaxPermSize=384m", then we got message that "ignoring option MaxPermSize=384m; support was removed in 8.0"

        But if we ran Java 9 with deprecated in JDK9 integer option, e.g. with "-XX:NmethodSweepFraction=10", then Java reports an error and exit: "Unrecognized VM option 'NmethodSweepFraction=10'".

        The problem in modified if statement in "Arguments::is_newly_obsolete" method in "src/share/vm/runtime/arguments.cpp":

        333 bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
        341 if (((strncmp(flag_status.name, s, len) == 0) &&
        342 (strlen(s) == len)) ||
        343 ((s[0] == '+' || s[0] == '-') &&
        344 (strncmp(flag_status.name, &s[1], len) == 0) &&
        345 (strlen(&s[1]) == len))) {

        Now function check that passed argument have the exactly the same length as defined in obsolete_jvm_flags, so "MaxPermSize=384m" and "MaxPermSize" are different.

        Special case should be added for integer options.

        Also, JDK-8060449 fix add call of "is_newly_obsolete" function for fuzzy matched option in Arguments::process_arguments function:

                        "Unrecognized VM option '%s'\n", argname);
            Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true);
            if (fuzzy_matched != NULL) {
                          "Did you mean '%s%s%s'? ",
                          (fuzzy_matched->is_bool()) ? "(+/-)" : "",
                          (fuzzy_matched->is_bool()) ? "" : "=<value>");
              if (is_newly_obsolete(fuzzy_matched->_name, &since)) {
                char version[256];
                since.to_string(version, sizeof(version));
                            "Warning: support for %s was removed in %s\n",

        But in this case it senseless, because fuzzy_match take flags from flag table, i.e. from non-deprecated flags and is_newly_obsolete get flags from obsolete_jvm_flags table. In normal conditions the option can not exist in two tables at the same time. So, is_newly_obsolete will always return false in this case.

        But if added "if (is_newly_obsolete)" will be deleted, then "test/runtime/CommandLine/ObsoleteFlagErrorMessage.java" test should be corrected. The following line should be deleted from test:

            output.shouldContain("support").shouldContain("removed"); // Should warn user that the option they are trying to use is no longer supported.

        The interesting thing, that now test passed, because test use "-XX:UseBoundThreads" option which incorrectly exists in obsolete_jvm_flags and in normal flag table. And in this case "fuzzy_match" found this option in flag table. But this is incorrect situation and soon "-XX:UseBoundThreads" will be deleted from set of existing flags.


            Issue Links



                mockner Max Ockner (Inactive)
                ddmitriev Dmitry Dmitriev
                0 Vote for this issue
                2 Start watching this issue