--- a/test/jdk/tools/jar/multiRelease/Basic.java Sun Jun 02 10:08:39 2019 +0200
+++ b/test/jdk/tools/jar/multiRelease/Basic.java Sun Jun 02 17:13:31 2019 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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
@@ -23,7 +23,7 @@
/*
* @test
- # @bug 8186087 8196748
+ # @bug 8186087 8196748 8212807
* @library /test/lib
* @modules java.base/jdk.internal.misc
* jdk.compiler
@@ -39,17 +39,20 @@
* @run testng Basic
*/
-import static org.testng.Assert.*;
-
import jdk.test.lib.util.FileUtils;
import org.testng.annotations.*;
import java.io.File;
-import java.nio.file.*;
-import java.util.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Map;
import java.util.jar.JarFile;
import java.util.zip.ZipFile;
+import static org.testng.Assert.*;
+
public class Basic extends MRTestBase {
@Test
@@ -60,7 +63,7 @@
compile("test01"); //use same data as test01
Path classes = Paths.get("classes");
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".")
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".")
.shouldHaveExitValue(SUCCESS);
checkMultiRelease(jarfile, false);
@@ -87,7 +90,7 @@
compile("test01");
Path classes = Paths.get("classes");
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", "9", "-C", classes.resolve("v9").toString(), ".",
"--release", "10", "-C", classes.resolve("v10").toString(), ".")
.shouldHaveExitValue(SUCCESS);
@@ -124,7 +127,7 @@
// valid
for (String release : List.of("10000", "09", "00010", "10")) {
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", release, "-C", classes.resolve("v10").toString(), ".")
.shouldHaveExitValue(SUCCESS)
.shouldBeEmptyIgnoreVMWarnings();
@@ -132,7 +135,7 @@
// invalid
for (String release : List.of("9.0", "8", "v9",
"9v", "0", "-10")) {
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", release, "-C", classes.resolve("v10").toString(), ".")
.shouldNotHaveExitValue(SUCCESS)
.shouldContain("release " + release + " not valid");
@@ -149,12 +152,12 @@
compile("test01"); //use same data as test01
Path classes = Paths.get("classes");
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".")
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".")
.shouldHaveExitValue(SUCCESS);
checkMultiRelease(jarfile, false);
- jar("uf", jarfile,
+ jarTool("uf", jarfile,
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
.shouldHaveExitValue(SUCCESS);
@@ -185,7 +188,7 @@
compile("test01"); //use same data as test01
Path classes = Paths.get("classes");
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
.shouldHaveExitValue(SUCCESS);
@@ -206,7 +209,7 @@
// write the v9 version/Version.class entry in base and the v10
// version/Version.class entry in versions/9 section
- jar("uf", jarfile, "-C", classes.resolve("v9").toString(), "version",
+ jarTool("uf", jarfile, "-C", classes.resolve("v9").toString(), "version",
"--release", "9", "-C", classes.resolve("v10").toString(), ".")
.shouldHaveExitValue(SUCCESS);
@@ -246,7 +249,7 @@
Path source = Paths.get(src, "data", "test04", "v9", "version");
javac(classes.resolve("v9"), source.resolve("Version.java"));
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
.shouldNotHaveExitValue(SUCCESS)
.shouldContain("different api from earlier");
@@ -268,7 +271,7 @@
Path source = Paths.get(src, "data", "test05", "v9", "version");
javac(classes.resolve("v9"), source.resolve("Extra.java"));
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
.shouldNotHaveExitValue(SUCCESS)
.shouldContain("contains a new public class");
@@ -290,7 +293,7 @@
Path source = Paths.get(src, "data", "test06", "v9", "version");
javac(classes.resolve("v9"), source.resolve("Extra.java"));
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
.shouldHaveExitValue(SUCCESS);
@@ -312,7 +315,7 @@
Path source = Paths.get(src, "data", "test01", "base", "version");
javac(classes.resolve("v9"), source.resolve("Version.java"));
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
.shouldHaveExitValue(SUCCESS)
.shouldContain("contains a class that")
@@ -332,11 +335,11 @@
Path classes = Paths.get("classes");
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
.shouldHaveExitValue(SUCCESS)
.shouldBeEmptyIgnoreVMWarnings();
- jar("uf", jarfile,
+ jarTool("uf", jarfile,
"--release", "10", "-C", classes.resolve("v9").toString(), ".")
.shouldHaveExitValue(SUCCESS)
.shouldContain("contains a class that")
@@ -359,7 +362,7 @@
Files.copy(base.resolve("Main.class"), base.resolve("Foo.class"));
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
.shouldNotHaveExitValue(SUCCESS)
.shouldContain("names do not match");
@@ -385,7 +388,7 @@
source = Paths.get(src, "data", "test10", "v9", "version");
javac(classes.resolve("v9"), source.resolve("Nested.java"));
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
.shouldHaveExitValue(SUCCESS);
@@ -413,7 +416,7 @@
source = Paths.get(src, "data", "test10", "v9", "version");
javac(classes.resolve("v9"), source.resolve("Nested.java"));
- List<String> output = jar("cf", jarfile,
+ List<String> output = jarTool("cf", jarfile,
"-C", classes.resolve("base").toString(), ".",
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
.shouldNotHaveExitValue(SUCCESS)
@@ -466,7 +469,7 @@
// remove the top level class, thus isolating the nested class
Files.delete(classes.resolve("v9").resolve("version").resolve("Nested.class"));
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
.shouldNotHaveExitValue(SUCCESS)
.shouldContain("an isolated nested class");
@@ -492,7 +495,7 @@
source = Paths.get(src, "data", "test13", "v10", "version");
javac(classes.resolve("v10"), source.resolve("Nested.java"));
- jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+ jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
"--release", "10", "-C", classes.resolve("v10").toString(), ".")
.shouldHaveExitValue(SUCCESS);
@@ -512,7 +515,7 @@
// create
Files.write(manifest, "Class-Path: MyUtils.jar\n".getBytes());
- jar("cfm", jarfile, manifest.toString(),
+ jarTool("cfm", jarfile, manifest.toString(),
"-C", classes.resolve("base").toString(), ".",
"--release", "10", "-C", classes.resolve("v10").toString(), ".")
.shouldHaveExitValue(SUCCESS)