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

Update JNI Specification of DestroyJavaVM for better alignment with JLS, JVMS, and Java SE API Specifications

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 20
    • hotspot
    • None
    • behavioral
    • minimal
    • Hide
      If you currently call `DestroyJavaVM` from a thread with Java frames it will trigger a crash, so there is no compatibility issue with fixing that for hotspot.

      Making it an error to call `DestroyJavaVM` from a thread with active frames could potentially require a change in behaviour in other implementations of the JNI Specification and Java VM, but we expect it to be extremely unlikely that other implementations would allow this to begin with.
      Show
      If you currently call `DestroyJavaVM` from a thread with Java frames it will trigger a crash, so there is no compatibility issue with fixing that for hotspot. Making it an error to call `DestroyJavaVM` from a thread with active frames could potentially require a change in behaviour in other implementations of the JNI Specification and Java VM, but we expect it to be extremely unlikely that other implementations would allow this to begin with.
    • Other
    • SE

      Summary

      Update the description of the JNI Invocation API methods to clarify their function, and to align descriptions and terminology with the JLS, JVMS and java.lang.Runtime specifications. Fix two behavioural aspects.

      Problem

      There are some updates pending to the JVMS, JLS, and the specification of java.lang.Runtime in the Java SE API that clarify the JDK shutdown sequence, JVM halt, and program exit. The JNI Specification needs some updates to align with these changes. Mostly these are just non-normative changes to the prose but there are two actual specification changes:

      1. The fact it is an error to detach a thread with active Java frames was only mentioned in the overview section, not in the actual DetachCurrentThread specification.

      2. We need to make it an error to call DestroyJavaVM from an attached thread with active Java frames (as this can't work for the same reason we disallow DetachCurrentThread). This also requires an implementation change in Hotspot.

      Solution

      Update the JNI Invocation API specification so that descriptions and terminology are consistent with those of the other specifications: JLS, JVMS, java.lang.Runtime.

      Define JNI_VERSION_20 as the latest JNI version due to the changed API semantics.

      Specification

      See attached spec-diff or https://cr.openjdk.java.net/~dholmes/8290482/8290482-jni-spec/diff.html

            dholmes David Holmes
            smarks Stuart Marks
            Alan Bateman, Robbin Ehn, Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: