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

JNI FindClass should specify that the class is initialized

XMLWordPrintable

    • behavioral
    • minimal
    • Hide
      There is no change in behaviour and so no compatability risk for users.

      If there are alternate implementations of the JNI specification it is possible they may not perform class initialization, in which case this specification "change" would require a change in behaviour for them. However, it is unlikely that any alternate implementation does not emulate the same behaviour as in the OpenJDK with the Hotspot VM.
      Show
      There is no change in behaviour and so no compatability risk for users. If there are alternate implementations of the JNI specification it is possible they may not perform class initialization, in which case this specification "change" would require a change in behaviour for them. However, it is unlikely that any alternate implementation does not emulate the same behaviour as in the OpenJDK with the Hotspot VM.
    • Other
    • SE

      Summary

      Add a statement that JNI FindClass initializes the class (if not already initialized), to match what the implementation has done since Java 1.2

      Problem

      JNI FindClass has ensured the class is initialized since Java 1.2, but the specification does not state this, it refers only to "loading and linking".

      Solution

      State that the class will be initialized.

      Specification

      diff -r 86692474afa6 closed/src/java.se/share/specs/jni/functions.md
      --- a/closed/src/java.se/share/specs/jni/functions.md
      +++ b/closed/src/java.se/share/specs/jni/functions.md
      @@ -587,8 +587,8 @@
       call native methods. `FindClass` locates the class loader associated with the
       current native method; that is, the class loader of the class that declared the
       native method. If the native method belongs to a system class, no class loader
      -will be involved. Otherwise, the proper class loader will be invoked to load
      -and link the named class.
      +will be involved. Otherwise, the proper class loader will be invoked to load,
      +link, and initialize, the named class.

            dholmes David Holmes
            dholmes David Holmes
            Harold Seigel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: