diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2022-03-31 11:31:20 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2022-03-31 14:14:45 +0700 |
commit | 417a0224e5f585850593ebac55b6083636a25fd9 (patch) | |
tree | a24de06e55c3e1c5c56bf515be924f9d73591cea /tests/src | |
parent | 35e93cf9dfc51aa8b47bc798c375b0ee01e24d42 (diff) | |
download | aspectj-417a0224e5f585850593ebac55b6083636a25fd9.tar.gz aspectj-417a0224e5f585850593ebac55b6083636a25fd9.zip |
Add some smoke test cases for '--add-reads' and '--add-modules'
in order to show that the compiler options basically work. The test
cases are by no means exhaustive and simply verify that it works at all.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java | 14 | ||||
-rw-r--r-- | tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml | 69 |
2 files changed, 79 insertions, 4 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java index a9f7f3023..5b2087ed2 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java @@ -61,10 +61,22 @@ public class Bugs199Tests extends XMLBasedAjcTestCase { runTest("asynchronous proceed for nested around-advice (native, thread pool)"); } - public void testAddExports() { + public void testAddExports_gh145() { runTest("use --add-exports"); } + public void testAddReads_gh145() { + runTest("use --add-reads"); + } + + public void testAddModules_gh145() { + runTest("use --add-modules"); + } + + public void testAddModulesJDK_gh145() { + runTest("use --add-modules with non-public JDK module"); + } + public static Test suite() { return XMLBasedAjcTestCase.loadSuite(Bugs199Tests.class); } diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml index 9a9ac2d47..7c38db68e 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml @@ -515,13 +515,76 @@ </run> </ajc-test> - <ajc-test dir="bugs199/add_exports" title="use --add-exports" vm="9"> - <compile files="Application.java" options="-11 --add-exports java.base/sun.security.x509=ALL-UNNAMED" /> - <run class="Application" vmargs="--add-exports java.base/sun.security.x509=ALL-UNNAMED"> + <ajc-test dir="bugs199/github_145/add_exports" title="use --add-exports" vm="9"> + <compile + files="Application.java" + options="-9 --add-exports java.base/sun.security.x509=ALL-UNNAMED" + /> + <run + class="Application" + vmargs="--add-exports java.base/sun.security.x509=ALL-UNNAMED" + > <stdout> <line text="java.security.cert.CertificateParsingException: java.io.IOException"/> </stdout> </run> </ajc-test> + <ajc-test dir="bugs199/github_145" title="use --add-reads" vm="9"> + <compile + files="add_modules/my.module/module-info.java add_modules/my.module/my/module/Modular.java" + options="-9" + outjar="my.module.jar" + /> + <compile + files="add_reads/other.module/module-info.java add_reads/other.module/other/module/Application.java" + options="-9 --add-reads other.module=my.module --add-exports my.module/my.module=other.module" + modulepath="$sandbox/my.module.jar" + outjar="other.module.jar" + /> + <run + class="other.module.Application" + vmargs="--add-reads other.module=my.module" + modulepath="$sandbox/my.module.jar:$sandbox/other.module.jar" + > + <stdout> + <line text="One modular class can use another one"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_145/add_modules" title="use --add-modules" vm="9"> + <compile + files="my.module/module-info.java my.module/my/module/Modular.java" + options="-9" + outjar="my.module.jar" + /> + <compile + files="NonModular.java" + options="-9 --add-modules my.module --add-exports my.module/my.module=ALL-UNNAMED" + modulepath="$sandbox/my.module.jar" + /> + <run class="NonModular" modulepath="$sandbox/my.module.jar"> + <stdout> + <line text="Non-modular class can use modular one"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_145/add_modules" title="use --add-modules with non-public JDK module" vm="9"> + <!-- + Javac, AJC: no errors. ECJ: "invalid module name: jdk.charsets" + + This is because ECJ does not add internal JDK modules as root modules, but AJC does. This was not so much + intentional in AJC, but simply due to the hacky implementation. Anyway, it works and makes AJC more + Javac-compliant than ECJ, which is nice. + --> + <compile files="UseJDKExtendedCharsets.java" options="-9 --add-modules jdk.charsets --add-exports jdk.charsets/sun.nio.cs.ext=ALL-UNNAMED" /> + <run class="UseJDKExtendedCharsets" vmargs="-ea --add-modules jdk.charsets --add-exports jdk.charsets/sun.nio.cs.ext=ALL-UNNAMED"> + <stdout> + <line text="ISO-2022-JP"/> + </stdout> + </run> + </ajc-test> + </suite> |