8204565: (spec) Document java.{vm.}?specification.version system properties' relation to $FEATURE

Reviewed-by: mchung
This commit is contained in:
Brent Christian 2018-06-12 14:08:24 -07:00
parent 4ad2957dd0
commit ea01772a00
3 changed files with 18 additions and 13 deletions
src/java.base/share/classes/java/lang
test
hotspot/jtreg/runtime/6981737
jdk/java/lang/System

@ -607,8 +607,9 @@ public final class System {
* <tr><th scope="row">{@code java.home}</th>
* <td>Java installation directory</td></tr>
* <tr><th scope="row">{@code java.vm.specification.version}</th>
* <td>Java Virtual Machine specification version which may be
* interpreted as a {@link Runtime.Version}</td></tr>
* <td>Java Virtual Machine specification version, whose value is the
* {@linkplain Runtime.Version#feature feature} element of the
* {@linkplain Runtime#version() runtime version}</td></tr>
* <tr><th scope="row">{@code java.vm.specification.vendor}</th>
* <td>Java Virtual Machine specification vendor</td></tr>
* <tr><th scope="row">{@code java.vm.specification.name}</th>
@ -621,8 +622,9 @@ public final class System {
* <tr><th scope="row">{@code java.vm.name}</th>
* <td>Java Virtual Machine implementation name</td></tr>
* <tr><th scope="row">{@code java.specification.version}</th>
* <td>Java Runtime Environment specification version which may be
* interpreted as a {@link Runtime.Version}</td></tr>
* <td>Java Runtime Environment specification version, whose value is
* the {@linkplain Runtime.Version#feature feature} element of the
* {@linkplain Runtime#version() runtime version}</td></tr>
* <tr><th scope="row">{@code java.specification.vendor}</th>
* <td>Java Runtime Environment specification vendor</td></tr>
* <tr><th scope="row">{@code java.specification.name}</th>

@ -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 "<major_version>"
*/
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);

@ -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.