Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java
40974 views
1
/*
2
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/**
25
* @test
26
* @bug 8175346 8175277
27
* @summary Test release option interactions
28
* @modules
29
* jdk.javadoc/jdk.javadoc.internal.api
30
* jdk.javadoc/jdk.javadoc.internal.tool
31
* jdk.compiler/com.sun.tools.javac.api
32
* jdk.compiler/com.sun.tools.javac.main
33
* @library /tools/lib
34
* @build toolbox.ToolBox toolbox.TestRunner
35
* @run main ReleaseOptions
36
*/
37
38
import java.nio.file.Path;
39
import java.nio.file.Paths;
40
41
import toolbox.*;
42
43
public class ReleaseOptions extends ModuleTestBase {
44
45
public static void main(String... args) throws Exception {
46
new ReleaseOptions().runTests();
47
}
48
49
@Test
50
public void testReleaseWithPatchModule(Path base) throws Exception {
51
Path src = Paths.get(base.toString(), "src");
52
Path mpath = Paths.get(src. toString(), "m");
53
54
tb.writeJavaFiles(mpath,
55
"module m { exports p; }",
56
"package p; public class C { }");
57
58
Task.Result result = execNegativeTask("--release", "8",
59
"--patch-module", "m=" + mpath.toString(),
60
"p");
61
assertMessagePresent(".*not allowed with target 8.*");
62
assertMessageNotPresent(".*Exception*");
63
assertMessageNotPresent(".java.lang.AssertionError.*");
64
}
65
66
@Test
67
public void testReleaseWithSourcepath(Path base) throws Exception {
68
Path src = Paths.get(base.toString(), "src");
69
Path mpath = Paths.get(src. toString(), "m");
70
71
tb.writeJavaFiles(mpath,
72
"module m { exports p; }",
73
"package p; public class C { }");
74
75
Task.Result result = execNegativeTask("--release", "8",
76
"--source-path", mpath.toString(),
77
"--module", "m");
78
assertMessagePresent(".*(use -source 9 or higher to enable modules).*");
79
assertMessageNotPresent(".*Exception*");
80
assertMessageNotPresent(".java.lang.AssertionError.*");
81
}
82
83
@Test
84
public void testReleaseWithModuleSourcepath(Path base) throws Exception {
85
Path src = Paths.get(base.toString(), "src");
86
Path mpath = Paths.get(src.toString(), "m");
87
88
tb.writeJavaFiles(mpath,
89
"module m { exports p; }",
90
"package p; public class C { }");
91
92
Task.Result result = execNegativeTask("--release", "8",
93
"--module-source-path", src.toString(),
94
"--module", "m");
95
assertMessagePresent(".*not allowed with target 8.*");
96
assertMessageNotPresent(".*Exception*");
97
assertMessageNotPresent(".java.lang.AssertionError.*");
98
}
99
}
100
101