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

JFR EventClassLoad event should not set initiating loader for hidden classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 15
    • hotspot
    • None
    • jfr
    • 15

      From JEP 371:

      Despite the fact that a hidden class has a corresponding Class object, and the fact that a hidden class's supertypes are created by class loaders, no class loader is involved in the creation of the hidden class itself. Notice that this JEP never says that a hidden class is "loaded". No class loaders are recorded as initiating loaders of a hidden class, and no loading constraints are generated that involve hidden classes. Consequently, hidden classes are not known to any class loader:

      https://openjdk.org/jeps/371
      ---

      Lookup.defineHiddenClass similarly states:

       C is derived with name CN, class loader L, and purported representation newBytes as if by the rules of JVMS 5.3.5, with the following adjustments:
      ...
          The Java Virtual Machine marks L as the defining class loader of C, but no class loader is recorded as an initiating class loader of C.
      ---

      However in SystemDictionary we have:

      void SystemDictionary::post_class_load_event(EventClassLoad* event, const InstanceKlass* k, const ClassLoaderData* init_cld) {
        assert(event != nullptr, "invariant");
        assert(k != nullptr, "invariant");
        event->set_loadedClass(k);
        event->set_definingClassLoader(k->class_loader_data());
        event->set_initiatingClassLoader(init_cld);
        event->commit();
      }

      which sets the initiating loader unconditionally.

            mgronlun Markus Grönlund
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: