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

Clarify ClassLoaderData::is_*_class_loader_data() method implementations

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 10
    • Fix Version/s: 11
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b01

      Description

      It looks like one of the intentions of the following three methods is to allow callers of them to determine whether or not a class can be unloaded. But if the class is a VM anonymous class then it can be unloaded regardless of its loader.

      // Returns true if this class loader data is for the system class loader.
      bool ClassLoaderData::is_system_class_loader_data() const {
        return SystemDictionary::is_system_class_loader(class_loader());
      }

      // Returns true if this class loader data is for the platform class loader.
      bool ClassLoaderData::is_platform_class_loader_data() const {
        return SystemDictionary::is_platform_class_loader(class_loader());
      }

      // Returns true if this class loader data is one of the 3 builtin
      // (boot, application/system or platform) class loaders. Note, the
      // builtin loaders are not freed by a GC.
      bool ClassLoaderData::is_builtin_class_loader_data() const {
        return (is_the_null_class_loader_data() ||
                SystemDictionary::is_system_class_loader(class_loader()) ||
                SystemDictionary::is_platform_class_loader(class_loader()));
      }

      So, either add checks for anonymous classes to the above methods and/or clarify their comments.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              hseigel Harold Seigel
              Reporter:
              hseigel Harold Seigel
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: