8173777: Merge javac -Xmodule into javac--patch-module
Converting uses of -Xmodule: to --patch-module. Reviewed-by: alanb, mchung
This commit is contained in:
parent
73a2915d57
commit
0f008adc1e
@ -28,13 +28,43 @@
|
||||
# @summary Tests that java.lang.AbstractMethodError is not thrown when
|
||||
# serializing improper version of DocumentImpl class.
|
||||
|
||||
OS=`uname -s`
|
||||
case "$OS" in
|
||||
SunOS )
|
||||
PS=":"
|
||||
;;
|
||||
Linux )
|
||||
PS=":"
|
||||
;;
|
||||
Darwin )
|
||||
PS=":"
|
||||
;;
|
||||
AIX )
|
||||
PS=":"
|
||||
;;
|
||||
Windows*)
|
||||
PS=";"
|
||||
;;
|
||||
CYGWIN*)
|
||||
PS=";"
|
||||
;;
|
||||
* )
|
||||
echo "Unrecognized system!"
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
|
||||
mkdir -p exec/java.xml compile/java.xml
|
||||
|
||||
$COMPILEJAVA/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
|
||||
-d compile/java.xml -Xmodule:java.xml $TESTSRC/Document.java $TESTSRC/Node.java || exit 1
|
||||
-d compile/java.xml --patch-module java.xml=$TESTSRC/patch-src1 \
|
||||
$TESTSRC/patch-src1/org/w3c/dom/Document.java \
|
||||
$TESTSRC/patch-src1/org/w3c/dom/Node.java || exit 1
|
||||
|
||||
$COMPILEJAVA/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
|
||||
-d exec/java.xml --patch-module java.xml=compile/java.xml -Xmodule:java.xml $TESTSRC/DocumentImpl.java || exit 2
|
||||
-d exec/java.xml --patch-module java.xml=compile/java.xml${PS}$TESTSRC/patch-src2 \
|
||||
$TESTSRC/patch-src2/com/sun/org/apache/xerces/internal/dom/DocumentImpl.java \
|
||||
|| exit 2
|
||||
|
||||
$COMPILEJAVA/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
|
||||
$TESTSRC/AbstractMethodErrorTest.java -d exec || exit 3
|
||||
|
@ -60,8 +60,8 @@ cd ${TESTSRC}
|
||||
TEST_JAVABASE=${TESTCLASSES}/java.base
|
||||
mkdir -p ${TEST_JAVABASE}
|
||||
${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
|
||||
-Xmodule:java.base \
|
||||
-d ${TEST_JAVABASE} Bug4170614Test.java
|
||||
--patch-module java.base=patch-src \
|
||||
-d ${TEST_JAVABASE} patch-src/java/text/Bug4170614Test.java
|
||||
|
||||
${TESTJAVA}/bin/java ${TESTVMOPTS} --patch-module java.base=${TEST_JAVABASE} java.text.Bug4170614Test
|
||||
|
||||
|
@ -87,11 +87,16 @@ public class ToolsOpts extends TestHelper {
|
||||
contents.add(" }\n");
|
||||
contents.add(" }\n");
|
||||
contents.add("}\n");
|
||||
createFile(new File(mainJava), contents);
|
||||
String mainJavaPath = "patch-src/com/sun/tools/javac/" + mainJava;
|
||||
File mainJavaFile = new File(mainJavaPath.replace('/', File.separatorChar));
|
||||
mainJavaFile.getParentFile().mkdirs();
|
||||
createFile(mainJavaFile, contents);
|
||||
|
||||
// compile Main.java into directory to override classes in jdk.compiler
|
||||
new File("jdk.compiler").mkdir();
|
||||
compile("-Xmodule:jdk.compiler", "-d", "jdk.compiler", mainJava);
|
||||
compile("--patch-module", "jdk.compiler=patch-src",
|
||||
"-d", "jdk.compiler",
|
||||
mainJavaFile.toString());
|
||||
}
|
||||
|
||||
static void pass(String msg) {
|
||||
|
@ -105,22 +105,24 @@ public class PatchTest {
|
||||
MODS_DIR.resolve("test"));
|
||||
assertTrue(compiled, "classes did not compile");
|
||||
|
||||
// javac -Xmodule:$MODULE -d patches1/$MODULE patches1/$MODULE/**
|
||||
// javac --patch-module $MODULE=patches1/$MODULE -d patches1/$MODULE patches1/$MODULE/**
|
||||
// jar cf patches/$MODULE-1.jar -C patches1/$MODULE .
|
||||
for (Path src : Files.newDirectoryStream(SRC1_DIR)) {
|
||||
Path output = PATCHES1_DIR.resolve(src.getFileName());
|
||||
String mn = src.getFileName().toString();
|
||||
compiled = CompilerUtils.compile(src, output, "-Xmodule:" + mn);
|
||||
compiled = CompilerUtils.compile(src, output,
|
||||
"--patch-module", mn + "=" + src.toString());
|
||||
assertTrue(compiled, "classes did not compile");
|
||||
JarUtils.createJarFile(PATCHES_DIR.resolve(mn + "-1.jar"), output);
|
||||
}
|
||||
|
||||
// javac -Xmodule:$MODULE -d patches2/$MODULE patches2/$MODULE/**
|
||||
// javac --patch-module $MODULE=patches2/$MODULE -d patches2/$MODULE patches2/$MODULE/**
|
||||
// jar cf patches/$MODULE-2.jar -C patches2/$MODULE .
|
||||
for (Path src : Files.newDirectoryStream(SRC2_DIR)) {
|
||||
Path output = PATCHES2_DIR.resolve(src.getFileName());
|
||||
String mn = src.getFileName().toString();
|
||||
compiled = CompilerUtils.compile(src, output, "-Xmodule:" + mn);
|
||||
compiled = CompilerUtils.compile(src, output,
|
||||
"--patch-module", mn + "=" + src.toString());
|
||||
assertTrue(compiled, "classes did not compile");
|
||||
JarUtils.createJarFile(PATCHES_DIR.resolve(mn + "-2.jar"), output);
|
||||
}
|
||||
|
@ -93,20 +93,22 @@ public class PatchTestWarningError {
|
||||
MODS_DIR.resolve("test"));
|
||||
assertTrue(compiled, "classes did not compile");
|
||||
|
||||
// javac -Xmodule:$MODULE -d patches1/$MODULE patches1/$MODULE/**
|
||||
// javac --patch-module $MODULE=patches1/$MODULE -d patches1/$MODULE patches1/$MODULE/**
|
||||
Path src = SRC1_DIR.resolve("java.base");
|
||||
Path output = PATCHES1_DIR.resolve(src.getFileName());
|
||||
Files.createDirectories(output);
|
||||
String mn = src.getFileName().toString();
|
||||
compiled = CompilerUtils.compile(src, output, "-Xmodule:" + mn);
|
||||
compiled = CompilerUtils.compile(src, output,
|
||||
"--patch-module", mn + "=" + src.toString());
|
||||
assertTrue(compiled, "classes did not compile");
|
||||
|
||||
// javac -Xmodule:$MODULE -d patches2/$MODULE patches2/$MODULE/**
|
||||
// javac --patch-module $MODULE=patches2/$MODULE -d patches2/$MODULE patches2/$MODULE/**
|
||||
src = SRC2_DIR.resolve("java.base");
|
||||
output = PATCHES2_DIR.resolve(src.getFileName());
|
||||
Files.createDirectories(output);
|
||||
mn = src.getFileName().toString();
|
||||
compiled = CompilerUtils.compile(src, output, "-Xmodule:" + mn);
|
||||
compiled = CompilerUtils.compile(src, output,
|
||||
"--patch-module", mn + "=" + src.toString());
|
||||
assertTrue(compiled, "classes did not compile");
|
||||
|
||||
}
|
||||
|
@ -73,9 +73,10 @@ public class PatchSystemModules {
|
||||
}
|
||||
|
||||
// compile patched source
|
||||
String patchDir = PATCH_SRC_DIR.resolve(JAVA_BASE).toString();
|
||||
assertTrue(CompilerUtils.compile(PATCH_SRC_DIR.resolve(JAVA_BASE),
|
||||
PATCH_DIR.resolve(JAVA_BASE),
|
||||
"-Xmodule:java.base"));
|
||||
"--patch-module", "java.base=" + patchDir));
|
||||
assertTrue(CompilerUtils.compile(PATCH_SRC_DIR.resolve("m2"),
|
||||
PATCH_DIR.resolve("m2")));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user