Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Upgrade from old compiler, adding methods to interface implementers via declare parent

Hi,
We have aspectj code using a really old version of the Aspectj compiler. This works fine with it, but we want to upgrade to the latest compiler. When I try to do that, I'm getting a compiler error as follows:

/home/rstone/workspace3/Adbase/src/main/java/com/vms/adbase/presentation/performance/SearchTimer.java:[23,8] cannot find symbol
symbol  : method setTimeout(int)
location: class com.vms.adbase.presentation.performance.SearchTimer

Sorry if this seems like a basic question, but we created a bunch of aspects years ago and have not upgraded our compiler. Now we need to and we have several examples like this, where we are adding methods to an interface, that are just not compiling with the new compiler.

Any ideas on how to fix this?

Thanks,
Rene


Aspect HasTimeoutImple.aj:

package com.vms.adbase.presentation.performance;

public aspect HasTimeoutImpl {
    private int HasTimeout.timeout = 0;
    public int HasTimeout.getTimeout(){
        return timeout;
    }
    public void HasTimeout.setTimeout(int newTimeout){
        timeout = newTimeout;
    }
}

Interface HasTimeout.java:
package com.vms.adbase.presentation.performance;

public interface HasTimeout {}


Aspect to add methods to SearchTimer:

package com.vms.adbase.presentation.performance;

import com.vms.adbase.util.sql.SQLUtil;

public aspect TimeoutPropagation{
    declare parents : SearchTimer implements HasTimeout;

    pointcut sqlUtilConstructions():
        call(SQLUtil+.new(..));

    pointcut timerMethods(HasTimeout timer) :
        execution(* HasTimeout+.*(..)) &&
        this(timer);

    pointcut sqlUtilConstructionsFromTimer(HasTimeout timer) :
        sqlUtilConstructions() && cflow(timerMethods(timer));

    after(HasTimeout timer) returning(SQLUtil newSQLUtil) :
        sqlUtilConstructionsFromTimer(timer){

        newSQLUtil.setTimeout(timer.getTimeout());
    }
}



Back to the top