8173163: searching for a versioned entry in a multi-release jar in hotspot is inconsistent with java code
authorccheung
Thu, 26 Jan 2017 10:17:06 -0800
changeset 43490 3c43be5db478
parent 43489 a07cb821130d
child 43491 656a9525a59c
child 43666 ad05e6f30cd2
child 43680 dd3ea9044937
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
hotspot/src/share/vm/classfile/classLoader.cpp
--- 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);