diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2023-01-04 14:55:42 +0100 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2023-01-04 15:19:53 +0100 |
commit | 5f46d44017d020822cf145ce0ff23cc44ecfdfad (patch) | |
tree | f7e35f321ddacbd86e06f383608891fb1bd3f63a | |
parent | c6a1bc127a9464bb1831fb04120123a62b100946 (diff) | |
download | aspectj-5f46d44017d020822cf145ce0ff23cc44ecfdfad.tar.gz aspectj-5f46d44017d020822cf145ce0ff23cc44ecfdfad.zip |
Fix parenthesised AJ keyword compiler problem
Fixes #20. Needs JDT Core grammar fix.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | tests/bugs1919/github_20/ParenthesisedAJKeywords.java | 33 | ||||
-rw-r--r-- | tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java | 5 | ||||
-rw-r--r-- | tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml | 19 |
4 files changed, 58 insertions, 1 deletions
@@ -21,7 +21,7 @@ <maven.javadoc.skip>true</maven.javadoc.skip> <!-- Dependency versions --> - <jdt.core.version>1.9.19</jdt.core.version> + <jdt.core.version>1.9.20-SNAPSHOT</jdt.core.version> <asm.version>9.4</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/bugs1919/github_20/ParenthesisedAJKeywords.java b/tests/bugs1919/github_20/ParenthesisedAJKeywords.java new file mode 100644 index 000000000..1ba013c57 --- /dev/null +++ b/tests/bugs1919/github_20/ParenthesisedAJKeywords.java @@ -0,0 +1,33 @@ +/** + * https://github.com/eclipse/org.aspectj/issues/20 + */ +public class ParenthesisedAJKeywords { + public static void main(String[] args) { + boolean before = true; + int after = 11; + String around = "around"; + boolean aspect = true; + int pointcut = 22; + String declare = "declare"; + String privileged = "privileged"; + + if ((before)) { + System.out.println(foo((before))); + switch ((after)) { + default: System.out.println("after"); + } + System.out.println((around)); + System.out.println(!(aspect) ? "no aspect" : "aspect"); + switch ((pointcut)) { + case 22: System.out.println("pointcut"); break; + default: System.out.println("xxx"); + } + System.out.println((declare)); + System.out.println((privileged)); + } + } + + public static String foo(boolean before) { + return (before) ? "before" : "after"; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java index 1cfb22ff5..112a4548c 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java @@ -22,6 +22,11 @@ public class Bugs1919Tests extends XMLBasedAjcTestCase { public void testsSwitchWith_Integer_MAX_VALUE() { runTest("switch with Integer.MAX_VALUE case"); } + + public void testsParenthesisedExpressionWithAjKeyword() { + runTest("parenthesised expression with AspectJ keyword"); + } + public static Test suite() { return XMLBasedAjcTestCase.loadSuite(Bugs1919Tests.class); } diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml index 60d7e4f86..918313b97 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml @@ -185,4 +185,23 @@ </run> </ajc-test> + <!-- + 'Syntax error, insert "Expression" to complete Expression' when compiling parenthesised expressions + containing AspectJ keywords, e.g. '(before)', see https://github.com/eclipse/org.aspectj/issues/20 + --> + <ajc-test dir="bugs1919/github_20" vm="1.5" title="parenthesised expression with AspectJ keyword"> + <compile files="ParenthesisedAJKeywords.java" options="-1.8 -showWeaveInfo"/> + <run class="ParenthesisedAJKeywords"> + <stdout> + <line text="before"/> + <line text="after"/> + <line text="around"/> + <line text="aspect"/> + <line text="pointcut"/> + <line text="declare"/> + <line text="privileged"/> + </stdout> + </run> + </ajc-test> + </suite> |