< prev index next >

test/java/lang/module/MultiReleaseJarTest.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -63,11 +63,11 @@
 @Test
 public class MultiReleaseJarTest {
 
     private static final String MODULE_INFO = "module-info.class";
 
-    private static final int RELEASE = Runtime.version().major();
+    private static final String RELEASE = "" + Runtime.version().major();
 
     // are multi-release JARs enabled?
     private static final boolean MULTI_RELEASE;
     static {
         String s = System.getProperty("jdk.util.jar.enableMultiRelease");

@@ -86,12 +86,12 @@
 
         Path jar = new JarBuilder(name)
                 .moduleInfo("module-info.class", descriptor)
                 .resource("p/Main.class")
                 .resource("p/Helper.class")
-                .resource("META-INF/versions/9/p/Helper.class")
-                .resource("META-INF/versions/9/p/internal/Helper9.class")
+                .resource("META-INF/versions/" + RELEASE + "/p/Helper.class")
+                .resource("META-INF/versions/" + RELEASE + "/p/internal/HelperNew.class")
                 .build();
 
         // find the module
         ModuleFinder finder = ModuleFinder.of(jar);
         Optional<ModuleReference> omref = finder.find(name);

@@ -129,13 +129,13 @@
 
         Path jar = new JarBuilder(name)
                 .moduleInfo(MODULE_INFO, descriptor1)
                 .resource("p/Main.class")
                 .resource("p/Helper.class")
-                .moduleInfo("META-INF/versions/9/" + MODULE_INFO, descriptor2)
-                .resource("META-INF/versions/9/p/Helper.class")
-                .resource("META-INF/versions/9/p/internal/Helper9.class")
+                .moduleInfo("META-INF/versions/" + RELEASE + "/" + MODULE_INFO, descriptor2)
+                .resource("META-INF/versions/" + RELEASE + "/p/Helper.class")
+                .resource("META-INF/versions/" + RELEASE + "/p/internal/HelperNew.class")
                 .build();
 
         // find the module
         ModuleFinder finder = ModuleFinder.of(jar);
         Optional<ModuleReference> omref = finder.find(name);

@@ -159,12 +159,12 @@
         String name = "m";
 
         Path jar = new JarBuilder(name)
                 .resource("p/Main.class")
                 .resource("p/Helper.class")
-                .resource("META-INF/versions/9/p/Helper.class")
-                .resource("META-INF/versions/9/p/internal/Helper9.class")
+                .resource("META-INF/versions/" + RELEASE + "/p/Helper.class")
+                .resource("META-INF/versions/" + RELEASE + "/p/internal/HelperNew.class")
                 .build();
 
         // find the module
         ModuleFinder finder = ModuleFinder.of(jar);
         Optional<ModuleReference> omref = finder.find(name);

@@ -198,11 +198,11 @@
                 .requires("jdk.unsupported")
                 .build();
 
         Path jar = new JarBuilder(name)
                 .moduleInfo(MODULE_INFO, descriptor1)
-                .moduleInfo("META-INF/versions/9/" + MODULE_INFO, descriptor2)
+                .moduleInfo("META-INF/versions/" + RELEASE + "/" + MODULE_INFO, descriptor2)
                 .build();
 
         // find the module
         ModuleFinder finder = ModuleFinder.of(jar);
         Optional<ModuleReference> omref = finder.find(name);
< prev index next >