Bug 112027 - unexpected error unboundFormalInPC
Summary: unexpected error unboundFormalInPC
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-08 02:49 EDT by Wes Isberg CLA
Modified: 2005-10-20 10:30 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wes Isberg CLA 2005-10-08 02:49:49 EDT
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);
    }
}
Comment 1 Andrew Clement CLA 2005-10-12 04:23:41 EDT
sort out for 1.5.0
Comment 2 Andrew Clement CLA 2005-10-18 11:40:05 EDT
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.
Comment 3 Andrew Clement CLA 2005-10-20 10:30:01 EDT
fix available.