[abc] Possible tracematch bug

From: Neil Ongkingco <neil.ongkingco@keb.ox.ac.uk>
Date: Fri Dec 09 2005 - 14:37:32 GMT

I get an exception when compiling the attached code. Also attached is
the stacktrace during the exception.

Neil

public class Main {
        static void f(A a) {
                a.lock();
                a.unlock();
        }

        static void g(A a) {
                a.lock();
        }

        static void h(A a) {
                a.lock();
                f(a);
                g(a);
                a.unlock();
        }

        static void k(A a) {
                a.lock();
                f(a);
                g(a);
        }

        public static void main(String args[]) {
                A a = new A();
                f(a);
                g(a);
                h(a);
                k(a);
        }
}

class A {
        A lock() {
                System.out.println("A.lock");
                return this;
        }
        void unlock() {
                System.out.println("A.unlock");
                return;
        }
}

aspect LockTraceMatch {

        private static boolean debug;
        private void debPrint(String s) {
                System.out.println(s);
        }

        pointcut anyfunc() : execution( * *(..));

        pointcut lock(A r) :
                execution(* A.lock()) && target(r);

        pointcut unlock(A r) :
                execution(* A.unlock()) && target(r);

        tracematch(A r, int i) {

                sym beforefunc before : anyfunc() && cflowdepth(i, anyfunc());
                sym afterfunc after : anyfunc() && cflowdepth(i, anyfunc());
                sym lock after : lock(r);
                sym unlock after : unlock(r);

                beforefunc lock afterfunc {
                        try {
                                throw new Exception("Unmatched lock");
                        } catch (Exception e) {
                                e.printStackTrace();
                        }
                }
        }
}

polyglot.util.InternalCompilerError: Main.java:59,1-73:2: Advice formal i not found
        at abc.weaving.matching.AdviceApplication.doShadows(AdviceApplication.java:190)
        at abc.main.AbcExtension.findMethodShadows(AbcExtension.java:466)
        at abc.weaving.matching.AdviceApplication.doMethod(AdviceApplication.java:264)
        at abc.weaving.matching.AdviceApplication.computeAdviceLists(AdviceApplication.java:301)
        at abc.weaving.aspectinfo.GlobalAspectInfo.computeAdviceLists(GlobalAspectInfo.java:462)
        at abc.tm.weaving.aspectinfo.TMGlobalAspectInfo.computeAdviceLists(TMGlobalAspectInfo.java:56)
        at abc.main.Main.weave(Main.java:931)
        at abc.main.Main.run(Main.java:519)
        at abc.main.Main.main(Main.java:206)
Caused by: polyglot.util.InternalCompilerError: Advice formal i not found
        at abc.weaving.aspectinfo.AdviceDecl.getFormalIndex(AdviceDecl.java:84)
        at abc.weaving.matching.AdviceFormals.getWeavingVar(AdviceFormals.java:42)
        at abc.weaving.matching.LocalsDecl.getWeavingVar(LocalsDecl.java:51)
        at abc.eaj.weaving.aspectinfo.CflowDepth.matchesAt(CflowDepth.java:78)
        at abc.weaving.aspectinfo.AndPointcut.matchesAt(AndPointcut.java:67)
        at abc.weaving.aspectinfo.LocalPointcutVars.matchesAt(LocalPointcutVars.java:67)
        at abc.weaving.matching.AdviceApplication$2.run(AdviceApplication.java:103)
        at abc.weaving.matching.AdviceApplication.doShadows(AdviceApplication.java:180)
        ... 8 more
Exception in thread "main"
Received on Fri Dec 9 16:18:46 2005

This archive was generated by hypermail 2.1.8 : Fri Dec 09 2005 - 18:00:08 GMT