From: Andy Clement Date: Wed, 14 Feb 2018 22:03:53 +0000 (-0800) Subject: more tests around module options X-Git-Tag: V1_9_0_RC4~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cf7484b3d30f12ea64eb2a936e1cbd05f2da8291;p=aspectj.git more tests around module options --- diff --git a/tests/bugs190/modules/ggg/aaa/bbb/A.java b/tests/bugs190/modules/ggg/aaa/bbb/A.java new file mode 100644 index 000000000..ca15681c6 --- /dev/null +++ b/tests/bugs190/modules/ggg/aaa/bbb/A.java @@ -0,0 +1,9 @@ +package aaa.bbb; +import ddd.D; + +public class A { + public static void main(String []argv) { + System.out.println("A running"); + D.foo(); + } +} diff --git a/tests/bugs190/modules/ggg/ddd/D.java b/tests/bugs190/modules/ggg/ddd/D.java new file mode 100644 index 000000000..d5a992d6e --- /dev/null +++ b/tests/bugs190/modules/ggg/ddd/D.java @@ -0,0 +1,5 @@ +package ddd; + +public class D { + public static void foo() {} +} diff --git a/tests/bugs190/modules/ggg/foo.jar b/tests/bugs190/modules/ggg/foo.jar new file mode 100644 index 000000000..d17415c0e Binary files /dev/null and b/tests/bugs190/modules/ggg/foo.jar differ diff --git a/tests/bugs190/modules/ggg/module-info.java b/tests/bugs190/modules/ggg/module-info.java new file mode 100644 index 000000000..60e9fdc99 --- /dev/null +++ b/tests/bugs190/modules/ggg/module-info.java @@ -0,0 +1,3 @@ +module my.module { + exports aaa.bbb; +} diff --git a/tests/bugs190/modules/hhh/aaa/bbb/A.java b/tests/bugs190/modules/hhh/aaa/bbb/A.java new file mode 100644 index 000000000..ca15681c6 --- /dev/null +++ b/tests/bugs190/modules/hhh/aaa/bbb/A.java @@ -0,0 +1,9 @@ +package aaa.bbb; +import ddd.D; + +public class A { + public static void main(String []argv) { + System.out.println("A running"); + D.foo(); + } +} diff --git a/tests/bugs190/modules/hhh/ddd/D.java b/tests/bugs190/modules/hhh/ddd/D.java new file mode 100644 index 000000000..d5a992d6e --- /dev/null +++ b/tests/bugs190/modules/hhh/ddd/D.java @@ -0,0 +1,5 @@ +package ddd; + +public class D { + public static void foo() {} +} diff --git a/tests/bugs190/modules/hhh/module-info-a.java b/tests/bugs190/modules/hhh/module-info-a.java new file mode 100644 index 000000000..c6a7a0321 --- /dev/null +++ b/tests/bugs190/modules/hhh/module-info-a.java @@ -0,0 +1,3 @@ +module my.module.a { + exports ddd; +} diff --git a/tests/bugs190/modules/hhh/module-info-b.java b/tests/bugs190/modules/hhh/module-info-b.java new file mode 100644 index 000000000..2300541ab --- /dev/null +++ b/tests/bugs190/modules/hhh/module-info-b.java @@ -0,0 +1,3 @@ +module my.module.b { + exports aaa.bbb; +} diff --git a/tests/bugs190/modules/iii/UsesJAXB.java b/tests/bugs190/modules/iii/UsesJAXB.java new file mode 100644 index 000000000..5eb9e59bc --- /dev/null +++ b/tests/bugs190/modules/iii/UsesJAXB.java @@ -0,0 +1,21 @@ +import javax.xml.transform.TransformerFactory; +import javax.xml.bind.JAXBContext; +import javax.xml.parsers.DocumentBuilderFactory; + +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; + +public class UsesJAXB { + + // private static final Logger LOG = LoggerFactory.getLogger(UsesJAXB.class); + + TransformerFactory tf = TransformerFactory.newInstance(); + + public UsesJAXB() { + // LOG.error("UMS001"); + Document document; + JAXBContext context; + } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java b/tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java index 607f723fc..52830ab28 100644 --- a/tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java @@ -13,13 +13,14 @@ package org.aspectj.systemtest.ajc190; import java.io.File; import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava9OrLater; import junit.framework.Test; /** * @author Andy Clement */ -public class Ajc190Tests extends org.aspectj.testing.XMLBasedAjcTestCase { +public class Ajc190Tests extends XMLBasedAjcTestCaseForJava9OrLater { public void testAnnotMethodHasMember_pr156962_1() { // From similar in Ajc153Tests runTest("Test Annot Method Has Member 1"); @@ -37,6 +38,10 @@ public class Ajc190Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testWeaveModule() throws Exception { runTest("weave module"); } + + public void testUsesJaxb() { + runTest("java use of java.xml.bind"); + } // --- diff --git a/tests/src/org/aspectj/systemtest/ajc190/ModuleTests.java b/tests/src/org/aspectj/systemtest/ajc190/ModuleTests.java index 5b5efb15b..9828aa17a 100644 --- a/tests/src/org/aspectj/systemtest/ajc190/ModuleTests.java +++ b/tests/src/org/aspectj/systemtest/ajc190/ModuleTests.java @@ -9,21 +9,22 @@ package org.aspectj.systemtest.ajc190; import java.io.File; -import junit.framework.Test; - import org.aspectj.apache.bcel.classfile.Attribute; import org.aspectj.apache.bcel.classfile.Code; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava9OrLater; + +import junit.framework.Test; /** - * Building and weaving with modules in the picture... + * Building and weaving with modules in the picture. * * @author Andy Clement * */ -public class ModuleTests extends org.aspectj.testing.XMLBasedAjcTestCase { +public class ModuleTests extends XMLBasedAjcTestCaseForJava9OrLater { public void testBuildAModule() { runTest("build a module"); @@ -44,31 +45,30 @@ public class ModuleTests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testBuildModuleIncludingAspects() { runTest("compile module including aspects"); } + + public void testBuildModuleAndApplyAspectsFromAspectPath() { + runTest("compile module and apply aspects via aspectpath"); + } public void testBinaryWeavingAModuleJar() { // Pass a module on inpath, does it weave ok with a source aspect, does it run afterwards? runTest("binary weaving module"); } - // can't really write these tests now... pure jdt seems to allow type resolution against module path for types - // not in modules being compiled but javac does not - - public void xtestReferenceTypesFromModuleInBuildingSomeCode() { - runTest("compile regular code using module code"); - } - - public void xtestReferenceTypesFromModuleInBuildingSomeCodeButCantSeeThem() { - runTest("compile regular code using module code that isn't visible"); + public void testModulepathClasspathResolution1() { + runTest("module path vs classpath 1"); } - public void xtestBinaryWeavingInvolvingTypesOnModulePath() { - fail(); +// public void testModulepathClasspathResolution2() { +// runTest("module path vs classpath 2"); +// } + + // This tests that when using --add-modules with one of the JDK modules (in the jmods subfolder of the JDK) + // that it can be found without needing to set --module-path (this seems to be implicitly included by javac too) + public void testAddModules1() { + runTest("java use of java.xml.bind"); } - public void xtestLoadtimeWeavingWithModulePathContainingTypes() { - fail(); - } - /* For the specified class, check that each method has a stackmap attribute */ private void checkStackMapExistence(String classname, String toIgnore) throws ClassNotFoundException { toIgnore = "_" + (toIgnore == null ? "" : toIgnore) + "_"; @@ -131,6 +131,7 @@ public class ModuleTests extends org.aspectj.testing.XMLBasedAjcTestCase { return XMLBasedAjcTestCase.loadSuite(ModuleTests.class); } + @Override protected File getSpecFile() { return getClassResource("ajc190.xml"); } diff --git a/tests/src/org/aspectj/systemtest/ajc190/ajc190.xml b/tests/src/org/aspectj/systemtest/ajc190/ajc190.xml index c2da5de60..2239d62c4 100644 --- a/tests/src/org/aspectj/systemtest/ajc190/ajc190.xml +++ b/tests/src/org/aspectj/systemtest/ajc190/ajc190.xml @@ -78,6 +78,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +