From: jhugunin Date: Tue, 7 Jan 2003 20:49:38 +0000 (+0000) Subject: tests from bugzilla X-Git-Tag: V_1_1_b5~146 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1e721079e0cec90516b4629272c178ff377ec75b;p=aspectj.git tests from bugzilla --- diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 5b6c70d8f..b5d9a0362 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -5432,4 +5432,20 @@ + + + + + + + + + + + + + + + diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index 6133db99d..142e7e30b 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -52,7 +52,6 @@ - diff --git a/tests/bugs/CloseConnectionsCflow.java b/tests/bugs/CloseConnectionsCflow.java new file mode 100644 index 000000000..10f0e330e --- /dev/null +++ b/tests/bugs/CloseConnectionsCflow.java @@ -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 index 000000000..ba6311748 --- /dev/null +++ b/tests/bugs/ConstructorArgTracing.java @@ -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 index 000000000..6c41e2861 --- /dev/null +++ b/tests/bugs/EnsureOverriding.java @@ -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; + } + } +} diff --git a/tests/jimTests.xml b/tests/jimTests.xml index 581a5bb80..57e827b8c 100644 --- a/tests/jimTests.xml +++ b/tests/jimTests.xml @@ -1,12 +1,7 @@ - - - - +