KlassFactory::create_from_stream should never return NULL

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 17
    • Affects Version/s: 17
    • Component/s: hotspot
    • b13

      https://github.com/openjdk/jdk/blob/044e2a2a499ff63dffae355b2254ec6bfcc3e01d/src/hotspot/share/classfile/klassFactory.cpp#L209

        InstanceKlass* result = parser.create_instance_klass(old_stream != stream, *cl_inst_info, CHECK_NULL);

        if (result == NULL) {
          return NULL;
        }

      But parser.create_instance_klass() will never return NULL in a normal return.

      We should get rid of the above "if" check. Then, we can remove unnecessary NULL checks by callers of create_from_stream. E.g., here in systemDictionary.cpp:

        InstanceKlass* k = KlassFactory::create_from_stream(st,
                                                            class_name,
                                                            loader_data,
                                                            cl_info,
                                                            CHECK_NULL);
        if ((cl_info.is_hidden() || is_unsafe_anon_class) && k != NULL) {

            Assignee:
            Coleen Phillimore
            Reporter:
            Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: