]> source.dussan.org Git - aspectj.git/commitdiff
Expand regression tests for GitHub bug #24
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Mon, 9 Jan 2023 16:53:30 +0000 (17:53 +0100)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Sun, 15 Jan 2023 13:41:51 +0000 (14:41 +0100)
More test cases were added for
  - multi-dimensional arrays,
  - primitive type arrays.

Relates to https://github.com/eclipse/org.aspectj/issues/24.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
tests/bugs1919/github_24/ExactlyMatchingAspect.aj
tests/bugs1919/github_24/FuzzilyMatchingAspect.aj
tests/bugs1919/github_24/MaybeMissingClass.java
tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml

index 8a78394c3be2c2ac22f011566802f0b50b9fe567..a884d00fcd21a8ae688cb4ade831f8d54b21b27b 100644 (file)
@@ -6,4 +6,20 @@ public aspect ExactlyMatchingAspect {
   after() : execution(public MaybeMissingClass[] MaybeMissingClass.*()) {
     System.out.println(thisJoinPoint);
   }
+
+  after() : execution(public MaybeMissingClass[][] MaybeMissingClass.*()) {
+    System.out.println(thisJoinPoint);
+  }
+
+  after() : execution(public int MaybeMissingClass.*()) {
+    System.out.println(thisJoinPoint);
+  }
+
+  after() : execution(public int[] MaybeMissingClass.*()) {
+    System.out.println(thisJoinPoint);
+  }
+
+  after() : execution(public int[][] MaybeMissingClass.*()) {
+    System.out.println(thisJoinPoint);
+  }
 }
index 9992828732544dec37b8ff2625e13e1b86e57067..d7c32a70a2a8ed870668ab4a1798df8de373adc7 100644 (file)
@@ -6,4 +6,20 @@ public aspect FuzzilyMatchingAspect {
   after() : execution(public MaybeMissing*[] MaybeMissing*.*()) {
     System.out.println(thisJoinPoint);
   }
+
+  after() : execution(public MaybeMissing*[][] MaybeMissing*.*()) {
+    System.out.println(thisJoinPoint);
+  }
+
+  after() : execution(public in* MaybeMissing*.*()) {
+    System.out.println(thisJoinPoint);
+  }
+
+  after() : execution(public in*[] MaybeMissing*.*()) {
+    System.out.println(thisJoinPoint);
+  }
+
+  after() : execution(public in*[][] MaybeMissing*.*()) {
+    System.out.println(thisJoinPoint);
+  }
 }
index 3fa5fa274137e2c915b3dcf4e96e016ff2887d0b..17952583bb72d7fe41a5a3a4793367e63676afe9 100644 (file)
@@ -2,6 +2,10 @@ public class MaybeMissingClass {
   public static void main(String[] args) {
     f1();
     f2();
+    f3();
+    f4();
+    f5();
+    f6();
   }
 
   public static MaybeMissingClass f1() {
@@ -13,4 +17,24 @@ public class MaybeMissingClass {
     System.out.println("MaybeMissingClass.f2");
     return null;
   }
+
+  public static MaybeMissingClass[][] f3() {
+    System.out.println("MaybeMissingClass.f3");
+    return null;
+  }
+
+  public static int f4() {
+    System.out.println("MaybeMissingClass.f4");
+    return 0;
+  }
+
+  public static int[] f5() {
+    System.out.println("MaybeMissingClass.f5");
+    return new int[2];
+  }
+
+  public static int[][] f6() {
+    System.out.println("MaybeMissingClass.f6");
+    return new int[2][2];
+  }
 }
index 67c0b6328cc58b67dcb963cff9b17cd526d8d1a3..15f5d18d6a05a0d1d8780eff2a1384b404aebb4b 100644 (file)
        <ajc-test dir="bugs1919/github_24" vm="1.5" title="exact array type matching, aspect compiled together with target class">
                <compile files="ExactlyMatchingAspect.aj MaybeMissingClass.java" options="-1.5 -showWeaveInfo">
                        <!-- Even before the bugfix, in this case weaving worked as expected -->
-                       <message kind="weave" text="method-execution(MaybeMissingClass MaybeMissingClass.f1())'"/>
-                       <message kind="weave" text="method-execution(MaybeMissingClass[] MaybeMissingClass.f2())'"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass MaybeMissingClass.f1())"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass[] MaybeMissingClass.f2())"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass[][] MaybeMissingClass.f3())"/>
+                       <message kind="weave" text="method-execution(int MaybeMissingClass.f4())"/>
+                       <message kind="weave" text="method-execution(int[] MaybeMissingClass.f5())"/>
+                       <message kind="weave" text="method-execution(int[][] MaybeMissingClass.f6())"/>
                </compile>
                <run class="MaybeMissingClass">
                        <stdout>
                                <line text="execution(MaybeMissingClass MaybeMissingClass.f1())"/>
                                <line text="MaybeMissingClass.f2"/>
                                <line text="execution(MaybeMissingClass[] MaybeMissingClass.f2())"/>
+                               <line text="MaybeMissingClass.f3"/>
+                               <line text="execution(MaybeMissingClass[][] MaybeMissingClass.f3())"/>
+                               <line text="MaybeMissingClass.f4"/>
+                               <line text="execution(int MaybeMissingClass.f4())"/>
+                               <line text="MaybeMissingClass.f5"/>
+                               <line text="execution(int[] MaybeMissingClass.f5())"/>
+                               <line text="MaybeMissingClass.f6"/>
+                               <line text="execution(int[][] MaybeMissingClass.f6())"/>
                        </stdout>
                </run>
        </ajc-test>
        -->
        <ajc-test dir="bugs1919/github_24" vm="1.5" title="exact array type matching, aspect compiled separately from target class">
                <compile files="ExactlyMatchingAspect.aj" options="-1.5 -showWeaveInfo" outjar="aspect.jar">
-                       <message kind="warning" text="no match for this type name: MaybeMissingClass [Xlint:invalidAbsoluteTypeName]"/>
-                       <message kind="warning" text="no match for this type name: MaybeMissingClass [Xlint:invalidAbsoluteTypeName]"/>
-                       <message kind="warning" text="no match for this type name: MaybeMissingClass [Xlint:invalidAbsoluteTypeName]"/>
                        <message kind="warning" text="no match for this type name: MaybeMissingClass [Xlint:invalidAbsoluteTypeName]"/>
                        <message kind="warning" text="advice defined in ExactlyMatchingAspect has not been applied [Xlint:adviceDidNotMatch]"/>
-                       <message kind="warning" text="advice defined in ExactlyMatchingAspect has not been applied [Xlint:adviceDidNotMatch]"/>
                </compile>
                <compile files="MaybeMissingClass.java" options="-1.5 -showWeaveInfo" aspectpath="aspect.jar">
                        <!-- Before the bugfix, f1 would be woven twice, f2 not at all-->
-                       <message kind="weave" text="method-execution(MaybeMissingClass MaybeMissingClass.f1())'"/>
-                       <message kind="weave" text="method-execution(MaybeMissingClass[] MaybeMissingClass.f2())'"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass MaybeMissingClass.f1())"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass[] MaybeMissingClass.f2())"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass[][] MaybeMissingClass.f3())"/>
+                       <message kind="weave" text="method-execution(int MaybeMissingClass.f4())"/>
+                       <message kind="weave" text="method-execution(int[] MaybeMissingClass.f5())"/>
+                       <message kind="weave" text="method-execution(int[][] MaybeMissingClass.f6())"/>
                </compile>
                <run class="MaybeMissingClass" classpath="aspect.jar">
                        <stdout>
                                <line text="execution(MaybeMissingClass MaybeMissingClass.f1())"/>
                                <line text="MaybeMissingClass.f2"/>
                                <line text="execution(MaybeMissingClass[] MaybeMissingClass.f2())"/>
+                               <line text="MaybeMissingClass.f3"/>
+                               <line text="execution(MaybeMissingClass[][] MaybeMissingClass.f3())"/>
+                               <line text="MaybeMissingClass.f4"/>
+                               <line text="execution(int MaybeMissingClass.f4())"/>
+                               <line text="MaybeMissingClass.f5"/>
+                               <line text="execution(int[] MaybeMissingClass.f5())"/>
+                               <line text="MaybeMissingClass.f6"/>
+                               <line text="execution(int[][] MaybeMissingClass.f6())"/>
                        </stdout>
                </run>
        </ajc-test>
        <ajc-test dir="bugs1919/github_24" vm="1.5" title="fuzzy array type matching, aspect compiled together with target class">
                <compile files="FuzzilyMatchingAspect.aj MaybeMissingClass.java" options="-1.5 -showWeaveInfo">
                        <!-- Before the bugfix, both f1 and f2 would be woven twice -->
-                       <message kind="weave" text="method-execution(MaybeMissingClass MaybeMissingClass.f1())'"/>
-                       <message kind="weave" text="method-execution(MaybeMissingClass[] MaybeMissingClass.f2())'"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass MaybeMissingClass.f1())"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass[] MaybeMissingClass.f2())"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass[][] MaybeMissingClass.f3())"/>
+                       <message kind="weave" text="method-execution(int MaybeMissingClass.f4())"/>
+                       <message kind="weave" text="method-execution(int[] MaybeMissingClass.f5())"/>
+                       <message kind="weave" text="method-execution(int[][] MaybeMissingClass.f6())"/>
                </compile>
                <run class="MaybeMissingClass">
                        <stdout>
                                <line text="execution(MaybeMissingClass MaybeMissingClass.f1())"/>
                                <line text="MaybeMissingClass.f2"/>
                                <line text="execution(MaybeMissingClass[] MaybeMissingClass.f2())"/>
+                               <line text="MaybeMissingClass.f3"/>
+                               <line text="execution(MaybeMissingClass[][] MaybeMissingClass.f3())"/>
+                               <line text="MaybeMissingClass.f4"/>
+                               <line text="execution(int MaybeMissingClass.f4())"/>
+                               <line text="MaybeMissingClass.f5"/>
+                               <line text="execution(int[] MaybeMissingClass.f5())"/>
+                               <line text="MaybeMissingClass.f6"/>
+                               <line text="execution(int[][] MaybeMissingClass.f6())"/>
                        </stdout>
                </run>
        </ajc-test>
        <ajc-test dir="bugs1919/github_24" vm="1.5" title="fuzzy array type matching, aspect compiled separately from target class">
                <compile files="FuzzilyMatchingAspect.aj" options="-1.5 -showWeaveInfo" outjar="aspect.jar">
                        <message kind="warning" text="advice defined in FuzzilyMatchingAspect has not been applied [Xlint:adviceDidNotMatch]"/>
-                       <message kind="warning" text="advice defined in FuzzilyMatchingAspect has not been applied [Xlint:adviceDidNotMatch]"/>
                </compile>
                <compile files="MaybeMissingClass.java" options="-1.5 -showWeaveInfo" aspectpath="aspect.jar">
                        <!-- Before the bugfix, both f1 and f2 would be woven twice -->
-                       <message kind="weave" text="method-execution(MaybeMissingClass MaybeMissingClass.f1())'"/>
-                       <message kind="weave" text="method-execution(MaybeMissingClass[] MaybeMissingClass.f2())'"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass MaybeMissingClass.f1())"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass[] MaybeMissingClass.f2())"/>
+                       <message kind="weave" text="method-execution(MaybeMissingClass[][] MaybeMissingClass.f3())"/>
+                       <message kind="weave" text="method-execution(int MaybeMissingClass.f4())"/>
+                       <message kind="weave" text="method-execution(int[] MaybeMissingClass.f5())"/>
+                       <message kind="weave" text="method-execution(int[][] MaybeMissingClass.f6())"/>
                </compile>
                <run class="MaybeMissingClass" classpath="aspect.jar">
                        <stdout>
                                <line text="execution(MaybeMissingClass MaybeMissingClass.f1())"/>
                                <line text="MaybeMissingClass.f2"/>
                                <line text="execution(MaybeMissingClass[] MaybeMissingClass.f2())"/>
+                               <line text="MaybeMissingClass.f3"/>
+                               <line text="execution(MaybeMissingClass[][] MaybeMissingClass.f3())"/>
+                               <line text="MaybeMissingClass.f4"/>
+                               <line text="execution(int MaybeMissingClass.f4())"/>
+                               <line text="MaybeMissingClass.f5"/>
+                               <line text="execution(int[] MaybeMissingClass.f5())"/>
+                               <line text="MaybeMissingClass.f6"/>
+                               <line text="execution(int[][] MaybeMissingClass.f6())"/>
                        </stdout>
                </run>
        </ajc-test>