[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Upgrade from old compiler, adding methods to interface implementers via declare parent
|
Hi,
I can help you work through this, but I am not sure anything has
really changed to affect how ITDs work. In the three example files
you included, I don't understand the relationship between SQLUtil and
HasTimeout? Is it via SearchTimer?
How old is the compiler you are on, 1.2?
public aspect HasTimeoutImpl {
private int HasTimeout.timeout = 0;
public int HasTimeout.getTimeout(){
return timeout;
}
public void HasTimeout.setTimeout(int newTimeout){
timeout = newTimeout;
}
}
this aspect will ensure that HasTimeout and anyone implementing
HasTimeout will get a 'setTimeout(int)', if they don't already provide
it. Are you compiling all the code together, or in separate stages?
cheers,
Andy
On 1 July 2011 11:58, Rene Stone <rstone@xxxxxxxxxxx> wrote:
> 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());
> }
> }
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>