JDK-8253136 : JMM_VERSION should remain at 0x20020000 (JDK 10) in JDK 11
  • Type: CSR
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 11.0.9
  • Submitted: 2020-09-14
  • Updated: 2020-09-16
  • Resolved: 2020-09-16
Related Reports
CSR :  
Description
Summary
-------

Change JMM_VERSION to 0x2002000 (JDK 10) in 11.0.9, and the @since javadoc tag for com.sun.managment.ThreadMXBean.getCurrentThreadAllocatedBytes to 11.0.9.

Problem
-------

JDK-8231209, which was originally pushed to JDK 14, has been backported to 11.0.9 and 11,0.10-oracle. Those backports changed JMM_VERSION from 0x20020000 (JDK 10) to 0x20030000 (JDK 14), which introduced an incompatibility that was overlooked in the backport CSRs JDK-8247807 (11.0.9) and JDK-8248871 (11.0.10-oracle). JDK 11 users checking for JMM_VERSION == 0x20020000 will find 0x2003000 instead and possibly abort. The issue was first noticed as part of reviewing a backport of JDK-8185003 to JDK 8: see the Description in the corresponding CSR JDK-8251498.


Solution
--------

JMM_VERSION in JDK 11 should be changed to 0x20020000 (JDK 10), and the @since javadoc tag for com.sun.management.ThreadMXBean.getCurrentThreadAllocatedBytes should be changed from 14 to 11.0.9.

Specification
-------------

Proposed patch:

```
--- old/src/hotspot/share/include/jmm.h	2020-09-14 14:12:47.000000000 -0700
+++ new/src/hotspot/share/include/jmm.h	2020-09-14 14:12:45.000000000 -0700
@@ -51,8 +51,7 @@
   JMM_VERSION_1_2_1 = 0x20010201, // JDK 7 GA
   JMM_VERSION_1_2_2 = 0x20010202,
   JMM_VERSION_2   = 0x20020000, // JDK 10
-  JMM_VERSION_3   = 0x20030000, // JDK 14
-  JMM_VERSION     = JMM_VERSION_3
+  JMM_VERSION     = JMM_VERSION_2
 };
 
 typedef struct {
--- old/src/jdk.management/share/classes/com/sun/management/ThreadMXBean.java	2020-09-14 14:12:53.000000000 -0700
+++ new/src/jdk.management/share/classes/com/sun/management/ThreadMXBean.java	2020-09-14 14:12:52.000000000 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,7 +135,7 @@
      * @see #isThreadAllocatedMemoryEnabled
      * @see #setThreadAllocatedMemoryEnabled
      *
-     * @since 14
+     * @since 11.0.9
      */
     public default long getCurrentThreadAllocatedBytes() {
         return getThreadAllocatedBytes(Thread.currentThread().getId());
```


Comments
Moving to Approved.
16-09-2020

I endorse this CSR. The same reasoning applies like for the corresponding 8u CSR which has just been approved ([https://bugs.openjdk.java.net/browse/JDK-8251498](https://bugs.openjdk.java.net/browse/JDK-8251498)).
15-09-2020