]> source.dussan.org Git - aspectj.git/commitdiff
added test for collection calls
authorwisberg <wisberg>
Sat, 27 Sep 2003 01:46:43 +0000 (01:46 +0000)
committerwisberg <wisberg>
Sat, 27 Sep 2003 01:46:43 +0000 (01:46 +0000)
docs/sandbox/sandbox-test.xml
docs/sandbox/testsrc/org/aspectj/langlib/PointcutsCW.java

index 0ca083c8c07207bc8b8fdf0fb5e326b1337a2e7f..8a5d0e287ba0dd736a1d140b3b13178119110f52 100644 (file)
                <compile files="common/org/aspectj/langlib/Pointcuts.java,
                                    testsrc/org/aspectj/langlib/PointcutsCW.java">
                                    
-                       <message kind="warning" line="159" text="anyConstructorExecution" file="Pointcuts.java"/>
+                       <message kind="warning" line="172" text="anyConstructorExecution" file="Pointcuts.java"/>
 
                        <message kind="warning" line="20" text="anyConstructorExecution"/>
                        <message kind="warning" line="20" text="anyPublicConstructorExecution"/>
                        <message kind="warning" line="173" text="anySystemProcessSpawningCalls"/>
                        <message kind="warning" line="177" text="mostThrowableReadCalls"/>
                        <message kind="warning" line="179" text="mostThrowableReadCalls"/>
-                       <message kind="warning" line="190" text="anyConstructorExecution"/>
-                       <message kind="warning" line="190" text="anyNonPrivateConstructorExecution"/>
-               </compile>
+                       <message kind="warning" line="184" text="anyCollectionWriteCalls"/>
+                       <message kind="warning" line="187" text="anyCollectionWriteCalls"/>
+                       <message kind="warning" line="189" text="anyCollectionWriteCalls"/>     
+                       <message kind="warning" line="189" text="anyNonPrivateFieldGet"/>       
+                       <message kind="warning" line="189" text="anyPublicFieldGet"/>   
+                       <message kind="warning" line="191" text="anyCollectionWriteCalls"/>
+                       <message kind="warning" line="201" text="anyConstructorExecution"/>
+                       <message kind="warning" line="201" text="anyNonPrivateConstructorExecution"/>
+                       </compile>
                <run class="org.aspectj.langlib.PointcutsCW"/>
        </ajc-test>
 
index bb5e2ade0aa20bf530248d900543f96796d171cf..ff64fad51af8a547d7dc13c78c831fbc3a06565a 100644 (file)
@@ -6,7 +6,7 @@ import java.awt.event.ActionEvent;
 import java.beans.PropertyChangeListener;
 import java.io.*;
 import java.lang.reflect.Method;
-
+import java.util.*;
 import javax.swing.*;
 import javax.swing.Action;
 
@@ -53,7 +53,7 @@ public aspect PointcutsCW {
     declare warning: Pointcuts.anySystemProcessSpawningCalls() : "anySystemProcessSpawningCalls";
     declare warning: Pointcuts.mostThrowableReadCalls() : "mostThrowableReadCalls";
     declare warning: Pointcuts.exceptionWrappingCalls() : "exceptionWrappingCalls";
-
+    declare warning: Pointcuts.anyCollectionWriteCalls() : "anyCollectionWriteCalls";
     //  CW anyMethodExecution, anyPublicMethodExecution, anyNonPrivateMethodExecution
     public static void main(String[] list) {
         new MemberTests(0).toString(); // RT cflowMainExecution
@@ -180,10 +180,21 @@ class MemberTests {
 
         e.getClass(); // not mostThrowableReadCalls b/c getClass() is Object
         
+        List list = new ArrayList();
+        list.add("one"); // CW anyCollectionWriteCalls
+        
+        // actually not writing, but staticly might
+        list.remove("two"); // CW anyCollectionWriteCalls
+        
+        list.removeAll(Collections.EMPTY_LIST); // CW anyCollectionWriteCalls, anyPublicFieldGet, anyNonPrivateFieldGet
+        
+        list.retainAll(list); // CW anyCollectionWriteCalls
+
     }
     
 }
 
+
 aspect DynamicTests {
     DynamicTests() {
         int i = 1;    // CW anyConstructorExecution, anyNonPrivateConstructorExecution XXX shows as 190, not 189?