Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8177155 Examine @CS methods when called from attached thread with no caller
  3. JDK-8281001

Class::forName(String) defaults to system class loader if the caller is null

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 19
    • Component/s: core-libs
    • Labels:
      None

      Description

      The current behavior of Class::forName(String className) if invoked via JNI code with no Java frame on the stack will use the boot loader to find class. In addition, the caller's loader is also used to check against the package access check (that check will be removed in the future. See JDK-8218203).

      JNI FindClass uses the system class loader instead if invoked via JNI invocation interface when there is no associated class loader.

      We should re-examine if we should make Class::forName when invoked by JNI code with no caller frame be consistent with JNI FindClass, i.e. use the system class loader if caller is null.

      The same behavior should apply to the following caller-sensitive methods related to class loading:
      Package::getPackage, Package::getPackages
      Runtime::load, Runtime::loadLibrary
      System::load, System::loadLibrary

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tprinzing Tim Prinzing
              Reporter:
              mchung Mandy Chung
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: