]> source.dussan.org Git - aspectj.git/commitdiff
Fix parenthesised AJ keyword compiler problem
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Wed, 4 Jan 2023 13:55:42 +0000 (14:55 +0100)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Wed, 4 Jan 2023 14:19:53 +0000 (15:19 +0100)
Fixes #20. Needs JDT Core grammar fix.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
pom.xml
tests/bugs1919/github_20/ParenthesisedAJKeywords.java [new file with mode: 0644]
tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java
tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml

diff --git a/pom.xml b/pom.xml
index ab3ff8e1b3c0de6245cda82f00194664708d2748..7090992c1bc55ab4f3f079f481c3eb4746ea9a39 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -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 (file)
index 0000000..1ba013c
--- /dev/null
@@ -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";
+  }
+}
index 1cfb22ff53b959f5ed53169d1f4d425618c491d9..112a4548c6d856f17055a575d23975a03ad8a445 100644 (file)
@@ -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);
   }
index 60d7e4f86e380b3208de532c23e98f6356750755..918313b97918f44d3b7d8219f8e8827c211e6d12 100644 (file)
                </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>