[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Target type wildcard and variable binding
|
The setName method is declared in JComponent - the declaring type
pattern of the call pcd matches based on where a method is declared,
whereas the target pcd matches based on the runtime type of the
target object.
Since JList is_a Component, you can simplify the advice in this case to:
before(JList list) : (call (* set*(..))) && target(list) {
AnalysisHelper.check(list);
}
assuming from your declaration that your intent is to match all setXXX
methods called on instances of JList?
Regards, Adrian.
On 20/09/05, Collinsworth, Troy Trent <tcollinsworth1@xxxxxxxxxxx> wrote:
>
> I am trying to write a pointcut for a method call on a target of
> java.awt.Component and all subclasses of Component. In the advice I need to
> interrogate the Component. However, I get warnings that the target type is
> not the correct type. Is it possible to accomplish this?
>
>
> Troy T. Collinsworth
>
>
> [iajc] see also:
> C:\view\...\AbstractMediator.java:193
> [iajc] C:\view\...\AbstractMediator.java:297 [warning]
> does not match because declaring type is javax.swing.JComponent, if match
> desired use target(javax.swing.JList)
> [Xlint:unmatchedSuperTypeInCall]
>
>
> public abstract class AbstractMediator ...
> public void register( String name, JComponent comp ) {
> comp.setName( name ); //line 193
> ....
>
>
> before(Component comp) : (call (* javax.swing.JList.set*(..))) &&
> target(comp) {
> AnalysisHelper.check(comp);
> }
>
>
>
> ________________________________
>
>
>
>
> The information contained in this message may be privileged,
> confidential, and protected from disclosure. If the reader of this
> message is not the intended recipient, or any employee or agent
> responsible for delivering this message to the intended recipient, you
> are hereby notified that any dissemination, distribution, or copying of
> this communication is strictly prohibited. If you have received this
> communication in error, please notify us immediately by replying to the
> message and deleting it from your computer.
>
> Thank you. Paychex, Inc.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
>
--
-- Adrian
adrian.colyer@xxxxxxxxx