diff --git a/src/java.base/share/classes/java/lang/System.java b/src/java.base/share/classes/java/lang/System.java
index d4cd69b1e1f..f1215fbf303 100644
--- a/src/java.base/share/classes/java/lang/System.java
+++ b/src/java.base/share/classes/java/lang/System.java
@@ -607,8 +607,9 @@ public final class System {
*
{@code java.home} |
* Java installation directory |
* {@code java.vm.specification.version} |
- * Java Virtual Machine specification version which may be
- * interpreted as a {@link Runtime.Version} |
+ * Java Virtual Machine specification version, whose value is the
+ * {@linkplain Runtime.Version#feature feature} element of the
+ * {@linkplain Runtime#version() runtime version} |
* {@code java.vm.specification.vendor} |
* Java Virtual Machine specification vendor |
* {@code java.vm.specification.name} |
@@ -621,8 +622,9 @@ public final class System {
*
---|
{@code java.vm.name} |
* Java Virtual Machine implementation name |
* {@code java.specification.version} |
- * Java Runtime Environment specification version which may be
- * interpreted as a {@link Runtime.Version} |
+ * Java Runtime Environment specification version, whose value is
+ * the {@linkplain Runtime.Version#feature feature} element of the
+ * {@linkplain Runtime#version() runtime version} |
* {@code java.specification.vendor} |
* Java Runtime Environment specification vendor |
* {@code java.specification.name} |
diff --git a/test/hotspot/jtreg/runtime/6981737/Test6981737.java b/test/hotspot/jtreg/runtime/6981737/Test6981737.java
index 3c131bbefc4..c8a12ded519 100644
--- a/test/hotspot/jtreg/runtime/6981737/Test6981737.java
+++ b/test/hotspot/jtreg/runtime/6981737/Test6981737.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, 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
@@ -23,7 +23,7 @@
/*
* @test Test6981737.java
- * @bug 6981737
+ * @bug 6981737 8204565
* @summary check for correct vm properties
* @run main Test6981737
* @author kamg
@@ -33,13 +33,12 @@ public class Test6981737 {
/**
* Check the 'vendor' properties and java.vm.specification.version property.
- * In jdk9 onwards they should be "Oracle..." and ""
*/
public static void main(String[] args) throws Exception {
String vendor_re = "Oracle Corporation";
- int major_version = Runtime.version().major();
- String vm_spec_version_re = Integer.toString(major_version);
+ int feature_version = Runtime.version().feature();
+ String vm_spec_version_re = Integer.toString(feature_version);
verifyProperty("java.vm.specification.vendor", vendor_re);
verifyProperty("java.specification.vendor", vendor_re);
diff --git a/test/jdk/java/lang/System/Versions.java b/test/jdk/java/lang/System/Versions.java
index 3ba41e1b1f3..41041acd188 100644
--- a/test/jdk/java/lang/System/Versions.java
+++ b/test/jdk/java/lang/System/Versions.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, 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
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 4989690 6259855 6706299
+ * @bug 4989690 6259855 6706299 8204565
* @summary Check that version-related system property invariants hold.
* @author Martin Buchholz
*/
@@ -72,13 +72,17 @@ public class Versions {
public static void main(String [] args) throws Exception {
String classVersion = getProperty("java.class.version");
String javaVersion = getProperty("java.version");
- String VMVersion = getProperty("java.vm.version");
String runtimeVersion = getProperty("java.runtime.version");
String specVersion = getProperty("java.specification.version");
+ String vmSpecVersion = getProperty("java.vm.specification.version");
+ String featureVersion = Integer.toString(Runtime.version().feature());
if (! (javaVersion.startsWith(specVersion) &&
- runtimeVersion.startsWith(specVersion)))
+ runtimeVersion.startsWith(specVersion) &&
+ specVersion.equals(featureVersion) &&
+ vmSpecVersion.equals(featureVersion))) {
throw new Exception("Invalid version-related system properties");
+ }
//----------------------------------------------------------------
// Check that java.class.version is correct.
---|