Skip to content

Commit 024404b

Browse files
committed
Copyright year and test reshuffeling
1 parent e53add4 commit 024404b

File tree

2 files changed

+18
-39
lines changed

2 files changed

+18
-39
lines changed

test/jdk/tools/jlink/basic/AllModulePath.java

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -125,27 +125,28 @@ public void testAllModulePath() throws Throwable {
125125
}
126126

127127
/*
128-
* Since ALL-MODULE-PATH does not allow --limit-modules. Add a test that
129-
* includes just a single module from the module path. This is just for
130-
* completeness and shows the intended replacement.
128+
* --add-modules ALL-MODULE-PATH with --limit-modules is an error
131129
*/
132130
@Test
133-
public void testSubsetModules() throws Throwable {
131+
public void testLimitModules() throws Throwable {
134132
if (isExplodedJDKImage()) {
135133
return;
136134
}
137-
138-
// create custom image
139-
Path image = HELPER.createNewImageDir("image1");
140-
// Instead of --add-modules ALL-MODULE-PATH [...] --limit-modules m1 do:
141-
List<String> opts = List.of("--module-path", MODS.toString(),
142-
"--output", image.toString(),
143-
"--add-modules", "m1");
144-
createImage(image, opts, true /* success */);
145-
146-
checkModules(image, Set.of("m1", "java.base"));
135+
Path targetPath = HELPER.createNewImageDir("all-mods-limit-mods");
136+
String moduleName = "com.baz.runtime";
137+
Result result = HELPER.generateDefaultJModule(moduleName, "jdk.jfr");
138+
Path customModulePath = result.getFile().getParent();
139+
List<String> allArgs = List.of("--add-modules", "ALL-MODULE-PATH",
140+
"--limit-modules", "jdk.jfr",
141+
"--module-path", customModulePath.toString(),
142+
"--output", targetPath.toString());
143+
JlinkOutput allOut = createImage(targetPath, allArgs, false /* success */);
144+
String actual = allOut.stdout.trim();
145+
String expected = "Error: --limit-modules not allowed with --add-modules ALL-MODULE-PATH";
146+
assertEquals(actual, expected);
147147
}
148148

149+
149150
/*
150151
* --add-modules *includes* ALL-MODULE-PATH with an existing module path
151152
*/
@@ -159,7 +160,7 @@ public void testAddModules() throws Throwable {
159160
Path image = HELPER.createNewImageDir("image2");
160161
List<String> opts = List.of("--module-path", MODS.toString(),
161162
"--output", image.toString(),
162-
"--add-modules", "m1,test",
163+
"--add-modules", "m1",
163164
"--add-modules", "ALL-MODULE-PATH");
164165
createImage(image, opts, true /* success */);
165166

@@ -206,28 +207,6 @@ public void modulePathEmpty() throws IOException {
206207
assertTrue(actual.contains(strNotExists));
207208
}
208209

209-
/*
210-
* --add-modules ALL-MODULE-PATH with --limit-modules is an error
211-
*/
212-
@Test
213-
public void testLimitModules() throws Exception {
214-
if (isExplodedJDKImage()) {
215-
return;
216-
}
217-
Path targetPath = HELPER.createNewImageDir("all-mods-limit-mods");
218-
String moduleName = "com.baz.runtime";
219-
Result result = HELPER.generateDefaultJModule(moduleName, "jdk.jfr");
220-
Path customModulePath = result.getFile().getParent();
221-
List<String> allArgs = List.of("--add-modules", "ALL-MODULE-PATH",
222-
"--limit-modules", "jdk.jfr",
223-
"--module-path", customModulePath.toString(),
224-
"--output", targetPath.toString());
225-
JlinkOutput allOut = createImage(targetPath, allArgs, false /* success */);
226-
String actual = allOut.stdout.trim();
227-
String expected = "Error: --limit-modules not allowed with --add-modules ALL-MODULE-PATH";
228-
assertEquals(actual, expected);
229-
}
230-
231210
/*
232211
* check the modules linked in the image using m1/p.ListModules
233212
*/

test/jdk/tools/jlink/basic/BasicTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it

0 commit comments

Comments
 (0)