Skip to content
Permalink
Browse files
8264032: Improve thread safety of Runtime.version()
Reviewed-by: shade, alanb
  • Loading branch information
turbanoff authored and shipilev committed Mar 23, 2021
1 parent 8c1ab38 commit 233536263e1096fb3219c4432177fb41cdab88e0
Showing 1 changed file with 6 additions and 4 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, Azul Systems, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -816,12 +816,14 @@ void loadLibrary0(Class<?> fromClass, String libname) {
* @since 9
*/
public static Version version() {
if (version == null) {
version = new Version(VersionProps.versionNumbers(),
var v = version;
if (v == null) {
v = new Version(VersionProps.versionNumbers(),
VersionProps.pre(), VersionProps.build(),
VersionProps.optional());
version = v;
}
return version;
return v;
}

/**

0 comments on commit 2335362

Please sign in to comment.