Skip to content

Commit

Permalink
Assumption no double concretization of abstract pointcuts plus
Browse files Browse the repository at this point in the history
supporting clauses in the weaverworld
  • Loading branch information
jfabry committed Sep 25, 2012
1 parent 33a458b commit 125393c
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 7 deletions.
10 changes: 9 additions & 1 deletion EkekoAspectJ/src/damp/ekeko/aspectj/assumptions.clj
Expand Up @@ -58,6 +58,14 @@
(ssoot/soot-method-called-by-method ?sootmethod ?caller)))))



;;Assumption no double concretization of abstract pointcuts
(defn
abstractpointcut-concretized-reconcretized
[?abpointcut ?concpointcut1 ?concpointcut2]
(all
(pointcut-concretizedby ?abpointcut ?concpointcut1)
(pointcut-concretizedby ?concpointcut1 ?concpointcut2)))




55 changes: 49 additions & 6 deletions EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
Expand Up @@ -294,6 +294,14 @@
(type ?aspect)])
(succeeds (.isAspect ?aspect))))

(defn
abstractaspect
"Relation of abstract aspects known to the weaver"
[?aspect]
(all
(aspect ?aspect)
(succeeds (.isAbstract ?aspect))))

(defn-
aspect-crosscuttingmembers
"Relation between an aspect and its CrosscuttingMembersSet."
Expand Down Expand Up @@ -717,24 +725,59 @@
aspect-pointcutdefinition
"Relation between an aspect and one of the pointcuts it declares.
Note that these are instances of ResolvedPointcutDefinition,
rather than the Pointcut instances within ShadowMungers (advice).
Link between PointcutDefinition and Pointcut (.getPointcut) seems broken though..."
rather than the Pointcut instances within ShadowMungers (advice)."
[?aspect ?pointcutdefinition]
(all
(aspect ?aspect)
(contains (.getDeclaredPointcuts ?aspect) ?pointcutdefinition) ;instance of ResolvedPointcutDefinition
(contains (.getDeclaredPointcuts ?aspect) ?pointcutdefinition)
))

(defn
pointcutdefinition
"Relation of pointcuts known to the weaver.
Note: these are instances of Pointcut rather than ResolvedPointcutDefinition."
Note: these are instances of ResolvedPointcutDefinition."
[?pointcut]
(fresh [?aspect]
(aspect-pointcutdefinition ?aspect ?pointcut)))


(defn
pointcut-name
"Relation of pointcuts and their name.
Note that pointcuts cannot be overloaded!"
[?pointcut ?name]
(all
(pointcutdefinition ?pointcut)
(equals ?name (.getName ?pointcut))))

(defn
abstractpointcut
"Relation of abstract pointcut definitions."
[?pointcut]
(all
(pointcutdefinition ?pointcut)
(succeeds (.isAbstract ?pointcut))))

(defn
concretepointcut
"Relation of concrete pointcut definitions."
[?pointcut]
(all
(pointcutdefinition ?pointcut)
(equals false (.isAbstract ?pointcut))))

(defn
pointcut-concretizedby
"Relation of (possibly abstract) pointcuts and their concretizing pointcuts.
Note that pointcuts cannot be overloaded!"
[?abstractpc ?concretepc]
(fresh [?abaspect ?concaspect ?name]
(abstractaspect ?abaspect) ;actually this clause is just an optimisation
(aspect-super+ ?concaspect ?abaspect)
(aspect-pointcutdefinition ?abaspect ?abstractpc)
(aspect-pointcutdefinition ?concaspect ?concretepc)
(pointcut-name ?abstractpc ?name)
(pointcut-name ?concretepc ?name)))


;(defn
; aspect-pointcut+
Expand Down
7 changes: 7 additions & 0 deletions TestCases/AJ-LMP-Pointcuts/.classpath
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
24 changes: 24 additions & 0 deletions TestCases/AJ-LMP-Pointcuts/.project
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>AJ-LMP-Pointcuts</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.ajdt.core.ajbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>damp.ekeko.plugin.ekekoBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.ajdt.ui.ajnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>damp.ekeko.plugin.ekekoNature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,28 @@
package cl.pleiad.ajlmp.testPointcuts;

public abstract aspect AbstractAspect {
abstract pointcut abstractpc1();

abstract pointcut abstractpc2();

pointcut concretepc1() : execution(* BaseClass.*2(..));

void around(): abstractpc1(){
System.out.println("AbstractAspect-Around1-1");
proceed();
System.out.println("AbstractAspect-Around1-2");
}

void around(): abstractpc2(){
System.out.println("AbstractAspect-Around2-1");
proceed();
System.out.println("AbstractAspect-Around2-2");
}

void around(): concretepc1(){
System.out.println("AbstractAspect-Around3-1");
proceed();
System.out.println("AbstractAspect-Around3-2");
}

}
@@ -0,0 +1,19 @@
package cl.pleiad.ajlmp.testPointcuts;

public class BaseClass {

public static void main(String[] args) {
BaseClass bc = new BaseClass();
bc.baseMethod1();
bc.baseMethod2();
}

public void baseMethod1(){
System.out.println("BaseClass-M1");
}

public void baseMethod2(){
System.out.println("BaseClass-M2");
}

}
@@ -0,0 +1,9 @@
package cl.pleiad.ajlmp.testPointcuts;

public abstract aspect FirstAspect extends AbstractAspect {

pointcut abstractpc1() : execution(* BaseClass.*1(..));

pointcut abstractpc2() : execution(* BaseClass.*2(..));

}
@@ -0,0 +1,7 @@
package cl.pleiad.ajlmp.testPointcuts;

public aspect SecondAspect extends FirstAspect {

pointcut abstractpc1() : execution(* BaseClass.*2(..));

}

0 comments on commit 125393c

Please sign in to comment.