From 742ae9055d4c9caa2194c64a129ba2d94b0fb6ec Mon Sep 17 00:00:00 2001 From: jhugunin Date: Tue, 31 Dec 2002 00:54:23 +0000 Subject: [PATCH] can't do around x initialization --- tests/ajcTests.xml | 3 ++- tests/new/AroundAll.java | 16 ++++++++++------ tests/new/AroundCall.java | 2 +- tests/new/AroundDoubleAssignmentC.java | 12 +++++++----- tests/new/CflowAlone.java | 3 ++- tests/new/CflowCycles.java | 2 +- tests/new/IfPCDAdviceMethods.java | 18 +++++++++++------- tests/new/PR559.java | 3 ++- 8 files changed, 36 insertions(+), 23 deletions(-) diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 85815b9d9..46693f8ae 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -3678,9 +3678,10 @@ + + keywords="from-resolved_10x,knownLimitation"> diff --git a/tests/new/AroundAll.java b/tests/new/AroundAll.java index 0200c5e0a..f7e57b5b9 100644 --- a/tests/new/AroundAll.java +++ b/tests/new/AroundAll.java @@ -145,16 +145,20 @@ aspect A { } static boolean test() { return true; } + + // one minimal version +// before(): this(Runnable) && call(* intValue()) { +// +// } - //before(): initialization(C.new(String)) { } - void around(String s): initialization(C.new(String)) && args(s) && if(s.equals("9")) { - log("C.new(9)"); - proceed(s+"1"); - } +// void around(String s): initialization(C.new(String)) && args(s) && if(s.equals("9")) { +// log("C.new(9)"); +// proceed(s+"1"); +// } Object around(): //initialization(C.new(String)) { - if(test()) && !within(A) && !call(* A.*(..)) && !preinitialization(new(..)) { + if(test()) && !within(A) && !call(* A.*(..)) && !initialization(new(..)) && !preinitialization(new(..)) { A.log("enter " + thisJoinPoint); Object ret = proceed(); A.log("exit " + thisJoinPoint); diff --git a/tests/new/AroundCall.java b/tests/new/AroundCall.java index 1a6905493..680f299c4 100644 --- a/tests/new/AroundCall.java +++ b/tests/new/AroundCall.java @@ -20,7 +20,7 @@ aspect TestAspect { /** @testcase PR#666 name binding in around cflow */ void around(final int n) : // no bug if before advice cflow(execution(void AroundCall.a(int)) && args(n)) // no bug if no args - && target(AroundCall) + && target(AroundCall) && !initialization(new(..)) { Tester.event("around"); if (n > 100) proceed(n); // some bugs hidden without call to proceed diff --git a/tests/new/AroundDoubleAssignmentC.java b/tests/new/AroundDoubleAssignmentC.java index 8127e57ac..edb481d4d 100644 --- a/tests/new/AroundDoubleAssignmentC.java +++ b/tests/new/AroundDoubleAssignmentC.java @@ -32,7 +32,8 @@ public aspect AroundDoubleAssignmentC { // instance initializer Tester.expectEvent("init"); - Tester.expectEvent("proceed-init"); + //XXX see below + //Tester.expectEvent("proceed-init"); String s = new Init().string; Tester.check("test".equals(s), "\"test\".equals(new Init().string)"); @@ -62,10 +63,11 @@ public aspect AroundDoubleAssignmentC { } // instance initializer - Object around() : initialization(Init.new(..)) { - Tester.event("proceed-init"); - return proceed(); - } + //XXX not implemented in 1.1 +// Object around() : initialization(Init.new(..)) { +// Tester.event("proceed-init"); +// return proceed(); +// } } class FieldInit { diff --git a/tests/new/CflowAlone.java b/tests/new/CflowAlone.java index abd2e42f7..b918c8fad 100644 --- a/tests/new/CflowAlone.java +++ b/tests/new/CflowAlone.java @@ -20,7 +20,8 @@ aspect Filteraspect { //pointcut goCut(): cflow(!within(FilterAspect)); //pointcut goCut(): cflow(within(FilterAspect)); //pointcut goCut(): cflow(within(testclass1)); - pointcut goCut(): !within(Filteraspect) && cflow(within(testclass1)) && !preinitialization(new(..)); + pointcut goCut(): !within(Filteraspect) && cflow(within(testclass1)) + && !preinitialization(new(..)) && !initialization(new(..)); // works ok //pointcut goCut(): within(Filteraspect); Object around(): goCut() { i++; return proceed(); } diff --git a/tests/new/CflowCycles.java b/tests/new/CflowCycles.java index 3bcabe612..0eeae1195 100644 --- a/tests/new/CflowCycles.java +++ b/tests/new/CflowCycles.java @@ -17,7 +17,7 @@ class Target { aspect A1 { pointcut TargetRunFlow () // ok if no cflow: within(Target) && execution(* *(..)) && !within(A1+); - : !within(A1+) && !preinitialization(new(..)) //cflow(within(Target) && execution(* *(..))) && !within(A1+) + : !within(A1+) && !preinitialization(new(..)) && !initialization(new(..))//cflow(within(Target) && execution(* *(..))) && !within(A1+) ; Object around () : TargetRunFlow() { Tester.event("target A1"); diff --git a/tests/new/IfPCDAdviceMethods.java b/tests/new/IfPCDAdviceMethods.java index 659b42ad7..26367d990 100644 --- a/tests/new/IfPCDAdviceMethods.java +++ b/tests/new/IfPCDAdviceMethods.java @@ -68,6 +68,8 @@ public class IfPCDAdviceMethods { for (int i = 0; i < cuts.length; i++) { for (int j = 0; j < kinds.length; j++) { for (int k = 0; k < ifs.length; k++) { + //XXX no around on initialization yet + if (kinds[j].equals("around") && cuts[i].equals("initialization_pc")) continue; TestContext.expectSignal(kinds[j] + "." + cuts[i] + "." + ifs[k]); } } @@ -77,7 +79,8 @@ public class IfPCDAdviceMethods { // Aspect namedIf delegate should have been called this many times // (todo: only checks for at-least, not for extra calls) - final int namedIfCalls = 2*cuts.length * (ifs.length-1); // -1 for anonymous, 2* for two calls + // -1 for anonymous, 2* for two calls, -1 for around initialization + final int namedIfCalls = 2*cuts.length * (ifs.length-1) - 1; for (int i = 0; i < namedIfCalls; i++) { TestContext.expectSignal("executedNamedIf:"+i); } @@ -196,14 +199,14 @@ aspect Aspect { void around() : call_pc () { a("around.call_pc.if(true)"); proceed(); } void around() : callType_pc() { a("around.callType_pc.if(true)"); proceed(); } void around() : execution_pc() { a("around.execution_pc.if(true)"); proceed(); } - void around() : initialization_pc() { a("around.initialization_pc.if(true)"); proceed(); } + //XXXvoid around() : initialization_pc() { a("around.initialization_pc.if(true)"); proceed(); } Object around() : named_set_pc () { a("around.set_pc.namedIf()"); return proceed(); } int around() : named_get_pc () { a("around.get_pc.namedIf()"); return proceed(); } void around() : named_call_pc () { a("around.call_pc.namedIf()"); proceed(); } void around() : named_callType_pc() { a("around.callType_pc.namedIf()"); proceed(); } void around() : named_execution_pc() { a("around.execution_pc.namedIf()"); proceed(); } - void around() : named_initialization_pc() { a("around.initialization_pc.namedIf()"); proceed(); } + //XXXvoid around() : named_initialization_pc() { a("around.initialization_pc.namedIf()"); proceed(); } // ------------------------------------- after after(): set_pc () { a("after.set_pc.if(true)"); } @@ -280,10 +283,11 @@ aspect Aspect2 { proceed(); } /** @testTarget ifpcd.compile.pcds.unnamed.initialization.around */ - void around() : if(true) && initialization(BaseApp.new(..)) { - a("around.initialization_pc.anonymous"); - proceed(); - } + //XXX +// void around() : if(true) && initialization(BaseApp.new(..)) { +// a("around.initialization_pc.anonymous"); +// proceed(); +// } /** @testTarget ifpcd.compile.pcds.unnamed.set.after */ after() : if(true) && set(int BaseApp.i) { diff --git a/tests/new/PR559.java b/tests/new/PR559.java index a612c9b81..c8da6e4ae 100644 --- a/tests/new/PR559.java +++ b/tests/new/PR559.java @@ -32,7 +32,8 @@ public class PR559 { } interface AspectMarker { - pointcut notInAspect() : ! within(AspectMarker+) && !preinitialization(new(..)); + pointcut notInAspect() : ! within(AspectMarker+) && + !preinitialization(new(..)) && !initialization(new(..)); pointcut allTarget() : execution(* Target.*(..)) ; pointcut allTargetFlow() : cflow(allTarget()); pointcut inTarget() : notInAspect() && allTarget(); -- 2.39.5