diff options
author | Andy Clement <aclement@pivotal.io> | 2022-02-25 13:28:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-25 13:28:33 -0800 |
commit | 7405690d0d8ab63bc45cc1fc79ad9141b5a0ddc1 (patch) | |
tree | 69aa79313dbb8ed4e22244881c8c632c2066c0c3 | |
parent | 0fe9c68ec1aecdd80798b0113bb02325162e2f36 (diff) | |
parent | f34c101b67aae84c53e792cbc31ab45f6303c6d7 (diff) | |
download | aspectj-7405690d0d8ab63bc45cc1fc79ad9141b5a0ddc1.tar.gz aspectj-7405690d0d8ab63bc45cc1fc79ad9141b5a0ddc1.zip |
Merge pull request #127 from kriegaex/gh-125
Fix classpath JAR close & re-open problem in AJC
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | tests/bugs198/github_125/Application.java | 11 | ||||
-rw-r--r-- | tests/pom.xml | 11 | ||||
-rw-r--r-- | tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java | 20 | ||||
-rw-r--r-- | tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java | 35 | ||||
-rw-r--r-- | tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml | 14 |
6 files changed, 69 insertions, 24 deletions
@@ -21,7 +21,7 @@ <maven.javadoc.skip>true</maven.javadoc.skip> <!-- Dependency versions --> - <jdt.core.version>1.9.8.RC3</jdt.core.version> + <jdt.core.version>1.9.9-SNAPSHOT</jdt.core.version> <asm.version>9.2</asm.version> <lib.ant.version>1.6.3</lib.ant.version> <lib.ant.xerces.version>2.6.2</lib.ant.xerces.version> diff --git a/tests/bugs198/github_125/Application.java b/tests/bugs198/github_125/Application.java new file mode 100644 index 000000000..7e893fc1a --- /dev/null +++ b/tests/bugs198/github_125/Application.java @@ -0,0 +1,11 @@ +public class Application { + public static void main(String[] argv) { + System.out.println("Hello world!"); + } + + static aspect MyAspect { + before(): execution(* Application.main(..)) { + System.out.println("Before advice"); + } + } +} diff --git a/tests/pom.xml b/tests/pom.xml index 8ab3878bc..33801c2f5 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -90,6 +90,17 @@ <version>${project.version}</version> <scope>test</scope> </dependency> + <!-- + Used for tests setting system properties, e.g. for AJC, when we need to avoid polluting the global + system properties namespace with settings potentially influencing other tests. + See https://github.com/bmuskalla/scoped-system-properties. + --> + <dependency> + <groupId>io.github.bmuskalla</groupId> + <artifactId>scoped-system-properties</artifactId> + <version>1.1.0</version> + <scope>test</scope> + </dependency> <!-- The tests need these during runtime, even though no direct usage is in our classes. diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java index 45a3b1d62..ef597c8f1 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java @@ -39,26 +39,6 @@ public class Ajc198TestsJava extends XMLBasedAjcTestCaseForJava17OrLater { checkVersion("PersonAspect", Constants.MAJOR_17, 0 /* Constants.PREVIEW_MINOR_VERSION */); } - public void testAnnotationStyleSpecialIfClauses() { - runTest("annotation style A"); - } - - public void testAnnotationStylePointcutInheritanceWithIfClauses() { - runTest("annotation style B"); - } - - public void testAnnotationStyleSpecialIfClauses2_gh120() { - runTest("annotation style C"); - } - - public void testAnnotationStyleSpecialIfClauses3_gh120() { - runTest("annotation style D"); - } - - public void testAnnotationStyleNegatedIf_gh122() { - runTest("annotation style negated if"); - } - public static Test suite() { return XMLBasedAjcTestCase.loadSuite(Ajc198TestsJava.class); } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java index d8e57b534..7982ec630 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java @@ -7,6 +7,8 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc198; +import io.bmuskalla.system.properties.PropertyEnvironment; +import io.bmuskalla.system.properties.ScopedSystemProperties; import junit.framework.Test; import org.aspectj.testing.XMLBasedAjcTestCase; @@ -15,9 +17,36 @@ import org.aspectj.testing.XMLBasedAjcTestCase; */ public class Bugs198Tests extends XMLBasedAjcTestCase { - public void testGitHub_105() { - runTest("ITD annotation with mandatory parameter via aspectpath"); - } + public void testGitHub_105() { + runTest("ITD annotation with mandatory parameter via aspectpath"); + } + + public void testAnnotationStyleSpecialIfClauses() { + runTest("annotation style A"); + } + + public void testAnnotationStylePointcutInheritanceWithIfClauses() { + runTest("annotation style B"); + } + + public void testAnnotationStyleSpecialIfClauses2_gh120() { + runTest("annotation style C"); + } + + public void testAnnotationStyleSpecialIfClauses3_gh120() { + runTest("annotation style D"); + } + + public void testAnnotationStyleNegatedIf_gh122() { + runTest("annotation style negated if"); + } + + public void testGitHub_125() { + try (PropertyEnvironment env = ScopedSystemProperties.newPropertyEnvironment()) { + env.setProperty("org.aspectj.weaver.openarchives", "20"); + runTest("compiler can re-open closed JARs"); + } + } public static Test suite() { return XMLBasedAjcTestCase.loadSuite(Bugs198Tests.class); diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml index 9874736dd..0eb413baa 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml @@ -153,4 +153,18 @@ </run> </ajc-test> + <ajc-test dir="bugs198/github_125" title="compiler can re-open closed JARs"> + <!-- + Here the Java test sets system property org.aspectj.weaver.openarchives to 20 in order to provoke + open JAR limit exhaustion + --> + <compile files="Application.java" options="-1.5" /> + <run class="Application"> + <stdout> + <line text="Before advice"/> + <line text="Hello world!"/> + </stdout> + </run> + </ajc-test> + </suite> |