]> source.dussan.org Git - aspectj.git/commitdiff
tests from bugzilla
authorjhugunin <jhugunin>
Tue, 7 Jan 2003 20:49:38 +0000 (20:49 +0000)
committerjhugunin <jhugunin>
Tue, 7 Jan 2003 20:49:38 +0000 (20:49 +0000)
tests/ajcTests.xml
tests/ajcTestsFailing.xml
tests/bugs/CloseConnectionsCflow.java [new file with mode: 0644]
tests/bugs/ConstructorArgTracing.java [new file with mode: 0644]
tests/bugs/EnsureOverriding.java [new file with mode: 0644]
tests/jimTests.xml

index 5b6c70d8f9c51bf99dc2c36a59a35dbec827cc2a..b5d9a0362fb72244c07f362b0acb9b13a139ca23 100644 (file)
         </compile>
     </ajc-test>
     
+    <ajc-test dir="bugs" pr="28702" title="percflow code hangs compiler">
+        <compile files="CloseConnectionsCflow.java">
+        </compile>
+    </ajc-test>
+    
+    <ajc-test dir="bugs" pr="28703" title="assert and pertarget crashes compiler">
+        <compile files="EnsureOverriding.java" options="-1.4"/>
+        <run class="EnsureOverriding"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs" pr="28852"
+      title="Verification error tracing constructor that takes arguments">
+        <compile files="ConstructorArgTracing.java"/>
+        <run class="ConstructorArgTracing"/>
+    </ajc-test>
+    
 </suite>
index 6133db99d373911ed95de68672a19179059932ad..142e7e30b8a36acbd564a8462c3bd556b35d9566 100644 (file)
@@ -52,7 +52,6 @@
         <run class="pack.ImportInnerFromInterfaceImplementor"/>
     </ajc-test>
 
-
     <ajc-test dir="bugs" pr="906"
       title="privileged access to code outside the control of the compiler">
         <compile files="PrivilegeBeyondScope.java">
diff --git a/tests/bugs/CloseConnectionsCflow.java b/tests/bugs/CloseConnectionsCflow.java
new file mode 100644 (file)
index 0000000..10f0e33
--- /dev/null
@@ -0,0 +1,57 @@
+// Bug # 28702
+
+import java.util.Stack;
+
+
+interface Connection {
+
+            Connection open();
+
+            void close();
+
+}
+
+
+aspect CloseConnectionsCflow percflow(layerEntryMethods()) {
+
+   Stack openConnections;
+
+   pointcut layerMethods() : 
+
+       execution(public * com.example.businessFacade.*.*(..));
+
+   pointcut layerEntryMethods() : 
+
+       layerMethods() && !cflowbelow(layerMethods());
+
+   pointcut openedConnection() : 
+
+       call(* Connection.open(..));
+
+   pointcut layerBoundary() : cflow(layerEntryMethods());
+
+
+   after() returning (Connection conn) : 
+
+           openedConnection() && layerBoundary() {
+
+       openConnections.push(conn);
+
+   }
+
+   after() : layerBoundary() {
+
+       while (!openConnections.empty()) {
+
+           Connection conn = (Connection)openConnections.pop();
+
+           conn.close();
+
+        }
+
+   }
+
+}
diff --git a/tests/bugs/ConstructorArgTracing.java b/tests/bugs/ConstructorArgTracing.java
new file mode 100644 (file)
index 0000000..ba63117
--- /dev/null
@@ -0,0 +1,16 @@
+// from Bug#:  28852  
+
+public class ConstructorArgTracing {
+    public ConstructorArgTracing(int arg) {
+    }
+
+    public static void main(String[] args) {
+        ConstructorArgTracing account = new ConstructorArgTracing(12345);
+    }
+}
+
+aspect TraceAspect {
+    before() : !within(TraceAspect) {
+        System.out.println(thisJoinPoint);
+    }
+}
diff --git a/tests/bugs/EnsureOverriding.java b/tests/bugs/EnsureOverriding.java
new file mode 100644 (file)
index 0000000..6c41e28
--- /dev/null
@@ -0,0 +1,45 @@
+// from Bug#:  28703  
+
+class Base {
+     /** extend when overriding - must call Base.lockResource() */
+      public void lockResource(boolean dummy) { /* ... */ }
+}
+
+class Derived extends Base {
+      boolean isLocked;
+
+      public void lockResource(boolean callSuper) {
+         if (callSuper) super.lockResource(true);
+          isLocked = true;
+      }
+}
+public aspect EnsureOverriding pertarget(mustExtend()) {
+    boolean calledSuper = false;
+    pointcut mustExtend() : 
+        execution(void Base+.lockResource(..)) && !within(Base);
+    after () returning: mustExtend() {
+        assert(calledSuper);
+        if (!calledSuper) { throw new RuntimeException("need super call"); }
+    }
+    after(Base a, Base b) returning: 
+            cflow(mustExtend() && target(a)) && execution(void Base.lockResource(..)) && target(b) 
+    {
+        if (a == b) {
+                //System.err.println("made call");
+            calledSuper = true;
+        }
+    }
+     public static void main(String args[]) {
+         (new Derived()).lockResource(true);
+         try {
+               (new Derived()).lockResource(false);
+               throw new Error("shouldn't get here");
+         } catch (RuntimeException re) {
+               if (!re.getMessage().equals("need super call")) throw re;
+         }     
+     }
+}
index 581a5bb800ad7b626a33ad754771622955c38b76..57e827b8c13e3586cfae69b2c6a215738ffe235a 100644 (file)
@@ -1,12 +1,7 @@
 <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd">
 <suite>
-    <ajc-test dir="new" pr="764"
-      title="binding handler args with indeterminate prefix and suffix"
-      keywords="from-resolved_105">
-        <compile files="IndeterminateHandlerArg.java"/>
-        <run class="IndeterminateHandlerArg"/>
-    </ajc-test>
 
+    
        <!--
     <ajc-test dir="base/test129"
       title="DEPRECATED: introduce of abstract methods works"