Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Can't override A.method() in all subclasses of A

It seems that what I'm trying to do is not possible with AspectJ - I'm just
looking for confirmation (unfortunately fearing the worst!).

I'm working on an Android project where I'm trying to remove the need to
implement onCreate() in every Activity subclass (which in Android you are
usually expected to override).

Given an Activity subclass:

public class AspectJActivity extends Activity {
}

I can easily introduce the onCreate() method in this single subclass with
the following aspect:

public aspect OnCreateAspect {

    public void AspectJActivity.onCreate(Bundle savedInstanceState) {
	//clever stuff goes here
    }
}

However, there appears to be no way to do this for /all/ Activity
subclasses. Because Activity already declares an onCreate() method, it seems
that mixins are not an option.

Is there an approach/workaround I'm missing? Is this beyond AspectJ's remit?

Cheers.

--
View this message in context: http://aspectj.2085585.n4.nabble.com/Can-t-override-A-method-in-all-subclasses-of-A-tp4439449p4439449.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


Back to the top