JDK-8162687 : java.{vm.}?specification.version is always set to the Java major version
  • Type: Bug
  • Component: other-libs
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • Submitted: 2016-07-28
  • Updated: 2018-06-13
  • Resolved: 2018-06-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorResolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
java.{vm.?}specification.version system properties are independent of java.version and are determined by the JCP (either a JSR or an Maintenance Release(MR)).  While it makes sense for these values to be $MAJOR for major releases, the JCP may choose to set them to other values during a subsequent MR.  In the case of Java SE 9, if there's ever an MR against JSR 379 (Java SE 9 Release Contents) the values may need to be updated to something besides $MAJOR.  

The value of the system property java.specification.version is currently set
in the build file common/autoconf/spec.gmk:

    VERSION_SPECIFICATION := @VERSION_MAJOR@

The value of the system property java.vm.specification.version is currently set in VM code in src/share/vm/runtime/arguments.cpp in the method Arguments::init_version_specific_system_properties(): 

    uint32_t spec_version = JDK_Version::current().major_version();

Ideally, these two issues should be handled at the same time.

Comments
As of JEP 322 ("Time-Based Release Versioning"), these properties are set based on VERSION_FEATURE. This is documented as of JDK-8204565. So this issue can be closed.
13-06-2018

The change needs to be done in hotspot to read the VERSION_SPECIFICATION value. The definition of VERSION_SPECIFICATION should reasonably stay at @VERSION_MAJOR@. If/when major and specification number diverges, fixing this in spec.gmk is a trivial one-line patch.
05-10-2016