JDK-8292897 : Update JNI Specification of DestroyJavaVM for better alignment with JLS, JVMS, and Java SE API Specifications
  • Type: CSR
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 20
  • Submitted: 2022-08-25
  • Updated: 2022-09-27
  • Resolved: 2022-09-27
Related Reports
CSR :  
Description
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 http://cr.openjdk.java.net/~dholmes/8290482/8290482-jni-spec/diff.html
Comments
Moving to Approved.
27-09-2022

Moving to Finalized as there has been no further feedback/commentary on this.
23-09-2022

Moving to Provisional.
07-09-2022

[~smarks] could you review this please. Thank you.
25-08-2022