[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Addressing classes that arent being compiled




You /can/ pass compiled .class files into the AspectJ weaver using the
-inpath option, but you probably don't want to be weaving rt.jar. Changing
your aspect slightly to:

pointcut textFieldInit() : call(JTextField+.new(..));

after () returning(JTextField textField) : textFieldInit()
{
  System.out.println("TextFieldInit!" + textField);
}

should give you want you want. The "call" pointcut matches join points on
the calling side, which is where you are...

20 April 2005 12:24
To: aspectj-users@xxxxxxxxxxx
cc:
From: Mark Kattenbelt <kattenbe@xxxxxxxxxxxxx>
Subject: [aspectj-users] Addressing classes that arent being compiled



Hello,

I'm new to AspectJ, and am very interested in it, but ran into a few
limitation I think. Ideally I would like my programs to contain separate
modules, say a GUI and a main program, without each of these being aware
of eachother. So I was just experimenting with this via AspectJ, and ran
into the following:

pointcut textFieldInit (JTextField textField) :
initialization(JTextField.new(..)) && this(textField);

after (JTextField textField) : textFieldInit(textField)
{
       System.out.println("TextFieldInit!" + textField);
       }

But this does not seem to work (only with classes that I have defined
myself), I think because the weaver cannot edit the class files of
JTextField. This makes sense to me but how else could you do anything
sensible with a GUI? Are there any examples where aspectJ binds a swing
GUI to the program?

Thanks for any help,

Mark
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users