From d0ad2422d172bc436dad619adf78ce51285c2388 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Wed, 24 Aug 2022 19:35:29 +0000 Subject: [PATCH] 8285497: Add system property for Java SE specification maintenance version Reviewed-by: dholmes, iris, mchung, andrew Backport-of: 31a63ba5f255e09349b3842984ac5bb3ad8e6c0b --- jdk/src/share/classes/java/lang/System.java | 16 +++++++++++++++- .../sun/security/provider/PolicyFile.java | 5 ++++- jdk/src/share/lib/security/java.policy | 1 + jdk/src/share/native/java/lang/System.c | 4 +++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/java/lang/System.java b/jdk/src/share/classes/java/lang/System.java index 5b2b3205578..33ee5ab4879 100644 --- a/jdk/src/share/classes/java/lang/System.java +++ b/jdk/src/share/classes/java/lang/System.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2022, 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 @@ -559,6 +559,10 @@ public static native void arraycopy(Object src, int srcPos, * Java installation directory * java.vm.specification.version * Java Virtual Machine specification version + * java.specification.maintenance.version + * Java Runtime Environment specification maintenance + * version, may be interpreted as a positive integer + * (optional, see below) * java.vm.specification.vendor * Java Virtual Machine specification vendor * java.vm.specification.name @@ -610,6 +614,16 @@ public static native void arraycopy(Object src, int srcPos, * User's current working directory * *

+ * The {@code java.specification.maintenance.version} property is + * defined if the specification implemented by this runtime at the + * time of its construction had undergone a maintenance + * release. When defined, its value identifies that + * maintenance release. To indicate the first maintenance release + * this property will have the value {@code "1"}, to indicate the + * second maintenance release this property will have the value + * {@code "2"}, and so on. + *

* Multiple paths in a system property value are separated by the path * separator character of the platform. *

diff --git a/jdk/src/share/classes/sun/security/provider/PolicyFile.java b/jdk/src/share/classes/sun/security/provider/PolicyFile.java index 5ed375c4870..097451da742 100644 --- a/jdk/src/share/classes/sun/security/provider/PolicyFile.java +++ b/jdk/src/share/classes/sun/security/provider/PolicyFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, 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 @@ -686,6 +686,9 @@ public Void run() { pe.add(new PropertyPermission ("java.specification.version", SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission + ("java.specification.maintenance.version", + SecurityConstants.PROPERTY_READ_ACTION)); pe.add(new PropertyPermission ("java.specification.vendor", SecurityConstants.PROPERTY_READ_ACTION)); diff --git a/jdk/src/share/lib/security/java.policy b/jdk/src/share/lib/security/java.policy index 59d99a964c4..8b628972008 100644 --- a/jdk/src/share/lib/security/java.policy +++ b/jdk/src/share/lib/security/java.policy @@ -36,6 +36,7 @@ grant { permission java.util.PropertyPermission "line.separator", "read"; permission java.util.PropertyPermission "java.specification.version", "read"; + permission java.util.PropertyPermission "java.specification.maintenance.version", "read"; permission java.util.PropertyPermission "java.specification.vendor", "read"; permission java.util.PropertyPermission "java.specification.name", "read"; diff --git a/jdk/src/share/native/java/lang/System.c b/jdk/src/share/native/java/lang/System.c index ff80b0abdd6..85dbe575cb1 100644 --- a/jdk/src/share/native/java/lang/System.c +++ b/jdk/src/share/native/java/lang/System.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2022, 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 @@ -214,6 +214,8 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props) PUTPROP(props, "java.specification.version", JDK_MAJOR_VERSION "." JDK_MINOR_VERSION); + PUTPROP(props, "java.specification.maintenance.version", + "4"); PUTPROP(props, "java.specification.name", "Java Platform API Specification"); PUTPROP(props, "java.specification.vendor",