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

JNI FindClass should specify that the class is initialized

    Details

    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      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.
    • Interface Kind:
      Other
    • Scope:
      SE

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dholmes David Holmes
                Reporter:
                dholmes David Holmes
                Reviewed By:
                Harold Seigel
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: