Community
Participate
Working Groups
In 1.5.0M4, I get error "the parameter tis is not bound in [all branches of] pointcut". Not true of 1.2.1. Untested in other development versions of 1.5.0. No branches (all &&) but duplicate specification of this(..). ------------------------------------------ package demo; /** * PerThis */ public class PerThis { public static void main(String[] args) { new This().test(); } } aspect PerThisTest perthis(pc()) { // TutIndex example-basic-perthis pointcut pc() : this(This) && !within(PerThisTest) && call(void run()); before(This tis) : pc() && this(tis){ System.out.println("bef " + this + " <-- " + tis); } } class This { int i; void test() { run(); } void run() { System.out.println("run " + this); } }
sort out for 1.5.0
Heres the smallest program with the problem: public aspect pr112027 { pointcut pc() : this(pr112027); before(pr112027 tis) : pc() && this(tis) { } } If we turn on pointcut rewriter debugging we can see whats happening: Initial pointcut is ==> (persingleton(pr112027) && (this(pr112027) && this(BindingTypePattern(pr112027, 0)))) Distributing NOT gives ==> (persingleton(pr112027) && (this(pr112027) && this(BindingTypePattern(pr112027, 0)))) Pull up disjunctions gives ==> (persingleton(pr112027) && (this(pr112027) && this(BindingTypePattern(pr112027, 0)))) Simplifying ANDs gives ==> (this(pr112027) && persingleton(pr112027)) Sorting ORs gives ==> (this(pr112027) && persingleton(pr112027)) Notice at the simplifying ands stage we have ditched the important binding pointcut designator! This happens because we collect all designators into a set during rewrite processing and this(pr112027) is considered equal to this(BindingTypePattern(pr112027, 0)) when of course they are a little different... the fix is to change the equals code to realise the difference. fix checked in (also tested it on Wes' larger program). waiting on build.
fix available.