[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Problem trying to research inner classe method and answer on ques tion mik
|
Wolvers, B. (Bas) wrote:
Please have a look at the following code:
public abstract exampleClass extends Observable
{
public Object getAction() {
return null;
}
}
public class exampleExtendedClass extends exampleClass
{
private Action anAction = new Action();
public Object getAction() {
return anAction;
}
private class Action extends AbstractAction {
public Action() {
//do things
}
public void actionPerformed(ActionEvent e) {
//click event -> on jmenuitem for example
}
}
}
I want an after aspect on the actionPerformed on all inner class extends
from AbstractAction
I use the following pointcut definition:
pointcut aspectBeforeActionPer() : call(*
javax.swing.AbstractAction.actionPerformed+(..));
I also tried the following
pointcut aspectBeforeActionPer() : call(*
javax.swing.AbstractAction+.actionPerformed(..));
Or
pointcut aspectBeforeActionPer() : call(*
javax.swing.AbstractAction.actionPerformed+(..)) && within(exampleClass+);
But the after advice is not reached
// after aspect
after() : aspectBeforeActionPer() {
System.out.println("ACTION PERFORMED");
}
Can anyone tell me what's wrong?
greetings,
Bas
For Mik:
Subject: RE: [aspectj-users] Compiler Error
Date: Mon, 1 Mar 2004 08:26:04 -0800
Reply-To: aspectj-users@xxxxxxxxxxx
As indicated on the download page AJDE for JBuilder 1.1.1 only supports the
JBuilder 9 distributions. AJDE 1.0.6 and 1.1b2 support JBuilder versions 4,
5, 6 and 7. The plan for AJDE 1.2 is to JBuilder X only.
Is it possible for you to upgrade?
--> For the research on aspectj I now use jBuilderX (this works fine) thanks
for your comment
Are you or your organization planning on sticking with JBuilder 7 for the
foreseeable future?
--> I can't answer this question, jBuilder 7 SE is for now good enough.
JBuilder X is a significant improvement, and I'm hoping that for the 1.2
release we get to focus our efforts on improving integration with that
version alone. But it would be good to have a sense of how many people are
stuck on older versions and will be slow to upgrade.
--> I can understand that new releases (of aspectj) will only be available
for the lastest jbuilder version, but new versions of jbuilder are often
released. It would be nice if latest aspectj compiler (1.1.1) is compatible
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users
If you can settle for an execution instead of a call this will work:
aspect A {
pointcut p() :
target(AbstractAction) &&
within(exampleExtendedClass) &&
execution(* *.actionPerformed(..));
before(): p() {
System.out.println(thisJoinPoint);
}
}
///// All the code
abstract class exampleClass extends Observable
{
public Object getAction() {
return null;
}
}
aspect A {
pointcut p() :
target(AbstractAction) &&
within(exampleExtendedClass) &&
execution(* *.actionPerformed(..));
before(): p() {
System.out.println(thisJoinPoint);
}
}
abstract class AbstractAction {
public abstract void actionPerformed(ActionEvent e);
}
abstract class Observable {}
class ActionEvent {}
public class exampleExtendedClass extends exampleClass
{
private Action anAction = new Action();
void bloo() { anAction.actionPerformed(null); }
public static void main(String[] args) {
new exampleExtendedClass().bloo();
new AnotherAction().actionPerformed(null);
}
private class Action extends AbstractAction {
public void actionPerformed(ActionEvent e) {
System.out.println("Action");
}
}
}
class AnotherAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
System.out.println("AnotherAction");
}
}
--
Jeffrey Palm --> http://www.ccs.neu.edu/home/jpalm