Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] is there way to get actual content of arguments in a method during weaving time?

Hi,

I'm afraid I can't think of a way you can do that.  Well I suppose I
can perhaps imagine changing AspectJ to to support constant references
(like your example) , but it wouldn't be so easy the minute you pass
an argument that was stored in a variable:

String a = "Jbutton" + " A";
jp.setToolTipText(a);

We just don't do that kind of analysis at weave time.

cheers,
Andy.

2008/12/5 wei sun <sw.weisun@xxxxxxxxx>:
> Hi there:
>
> For example:
>
> package X.X.X;
> Class A{
>     Jbutton jb = new Jbutton ();
>     jb.setToolTipText("Jbutton A");
> }
>
> pointcut MLSwing(String s):call (*
> javax.swing..*+.setToolTipText(String))&&args(s)
>
> and now if I open showWeaveInfo="true" option, the output would be as
> follow:
>
> Join point 'method-call(void javax.swing.JLabel.setText(java.lang.String))'
> in Type 'X.X.X.A' (A.java:4) advised by ...
>
>
> My question is any way that I can figure out the value of the argument at
> weaving time? here is "Jbutton A" !
>
> so the new output looks like:
> Join point 'method-call(void javax.swing.JLabel.setText(java.lang.String
> Jbutton A))' in Type 'X.X.X.A' (A.java:4) advised by ...
>
> Thanks very much!
>
> wei sun
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top