8173163: searching for a versioned entry in a multi-release jar in hotspot is inconsistent with java code
Summary: use the highest versioned entry if the specified version is higher than the current jdk version
Reviewed-by: iklam, sspitsyn, jiangli
--- a/hotspot/src/share/vm/classfile/classLoader.cpp Thu Jan 26 05:53:14 2017 -0800
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp Thu Jan 26 10:17:06 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -364,7 +364,12 @@
if (verstr != NULL) {
version = atoi(verstr);
if (version < base_version || version > cur_ver) {
- is_multi_ver = false;
+ // If the specified version is lower than the base version, the base
+ // entry will be used; if the version is higher than the current
+ // jdk version, the highest versioned entry will be used.
+ if (version < base_version) {
+ is_multi_ver = false;
+ }
// print out warning, do not use assertion here since it will continue to look
// for proper version.
warning("JDK%d is not supported in multiple version jars", version);