Closed jfabry closed 11 years ago
What I need to be able to do is something like this:
(defn
aspect-usedpointcut
[?aspect ?pointcut]
(l/fresh [?advice]
(aspect-advice ?aspect ?advice)
(advice-pointcut ?advice ?pointcut)))
;; does not work due to issue #6: these guys here do not have a name
(defn
aspect-usedpointcutname
[?aspect ?pointcutname]
(l/fresh [?pointcut]
(aspect-usedpointcut ?aspect ?pointcut)
(pointcut-name ?pointcut ?pointcutname)))
And something like this:
(defn aspect-allusedpointcuts
[?aspect ?usedpointcuts]
(l/all
(aspect ?aspect)
(findall ?usedpointcut (aspect-usedpointcut ?aspect ?usedpointcut) ?usedpointcuts)))
(defn
samepointcuts-reuse-super-sub1-sub2
[?aspect1 ?aspect2 ?usedpc1 ?usedpc2]
(l/fresh [?superaspect]
(aspect-declaredsuperaspect+ ?aspect1 ?superaspect)
(aspect-declaredsuperaspect+ ?aspect2 ?superaspect)
(l/!= ?aspect1 ?aspect2)
(aspect-allusedpointcuts ?aspect1 ?usedpc1)
(aspect-allusedpointcuts ?aspect2 ?usedpc2)
(same-elements ?usedpc1 ?usedpc2)
))
Does not seem to work for me. What is wrong with the following?
=> (ekeko [?pointcutdef ?newpointcutdef] (pointcut-concretizedby ?pointcutdef ?newpointcutdef))
([#<ResolvedPointcutDefinition pointcut cl.pleiad.ajlmp.testRefineUsedPointcuts.FirstAspect.pc1()> #<ResolvedPointcutDefinition pointcut cl.pleiad.ajlmp.testRefineUsedPointcuts.SecondAspect.pc1()>])
-> OK
=> (ekeko [?pointcutdef ?newpointcutdef ?pointcut]
(l/all
(pointcut-concretizedby ?pointcutdef ?newpointcutdef)
(pointcutdefinition-pointcut ?pointcutdef ?pointcut)))
()
-> NOK!
Abstract pointcut definitions don't have a pointcut.
Changing ?pointcutdef into ?newpointcutdef in the second condition works:
=> (damp.ekeko/ekeko [?pointcutdef ?newpointcutdef ?pointcut]
(pointcutdefinition-concretizedby ?pointcutdef ?newpointcutdef)
(pointcutdefinition-pointcut ?newpointcutdef ?pointcut))
([#<ResolvedPointcutDefinition pointcut cl.pleiad.ajlmp.testRefineUsedPointcuts.FirstAspect.pc1()> #<ResolvedPointcutDefinition pointcut cl.pleiad.ajlmp.testRefineUsedPointcuts.SecondAspect.pc1()> #<KindedPointcut execution(* cl.pleiad.ajlmp.testRefineUsedPointcuts.BaseClass.*1(..))>])
(Above commit renamed pointcut-concretizedby
to pointcutdefinition-concretizedby
and added a pointcutdefinition|concrete
condition on its second argument to be absolutely sure that the documentation "Relation of (possibly abstract) pointcut definitions and their concretizing (definitely concrete) pointcuts." holds).
I dont agree that abstract pointcuts dont have a pointcutdefinition. It's there although void. If I don't have that the assumption will not work.
The new, brief code for the assumption is
(damp.ekeko/ekeko [?pointcutdef ?newpointcutdef ?advice]
(pointcutdefinition-concretizedby ?pointcutdef ?newpointcutdef)
(advice-pointcutdefinition ?advice ?pointcutdef)
should match on the use of pc1 in FirstAspect because that aspect sais:
before() : pc1() {
System.out.println("FirstAspect-Before-1");
}
After discussion I see the error of my ways.
The pointcuts returned by the predicates should be of the same 'thing' so they can be unified.
Example in the AJ-LMP-RefineUsedPointcut project:
versus