[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [ajdt-dev] Args evaluation in non-proceeding around()
|
I would like to know if the AspectJ around() construct
> allows
> to someway avoid evaluation of the actual method
> parameters
No.
It's hard if not impossible to determine in bytecode when
"argument evaluation" starts, so you couldn't make a join
point that was stable. Besides, you'd end up with
different results from two synonymous snippets:
foo(bar(), bash());
and
x = bar();
y = bash();
foo(x, y);
That said, you can defer argument stringifying, e.g., by
using printf-style formatting or smarter apis, like
"log(String format, Object[] stuff)" - but that involves
the refactoring you're probably trying to avoid.
Wes
On Mon, 13 Mar 2006 19:01:23 +0100 (CET)
"Tommaso Cucinotta" <tommaso@xxxxxxxxxxxx> wrote:
> Hi all,
>
> I would like to know if the AspectJ around() construct
> allows
> to someway avoid evaluation of the actual method
> parameters
> in the cases in which they are not needed.
>
> What I would like to do is smth. like this: transform any
> call to
>
> myObj.myMeth(arg1, arg2, ...);
>
> into smth. like this:
>
> if (condition) {
> myObj.myMeth(arg1, arg2, ...);
> }
>
> Now, I would like to have the arguments arg1, arg2, ...
> *not*
> even evaluated if the condition is false, so that this
> allows me
> to leave the overhead (and side-effects) possibly
> introduced by such
> parameter evaluation out of the program at all.
>
> AFAICS, the current version of AspectJ evaluates the
> arguments anycase,
> and it only allows me to skip the myMeth() call itself,
> but the
> actual method parameters get evaluated (along with the
> possible side
> effects caused by such evaluation).
>
> For example, this could be applied in logging-like
> applications to avoid
> the stringification of the arguments at all, whenever the
> configured log
> level does not allow the message to be logged.
>
> Many thanks in advance,
>
> regards,
>
> tom.
>
>
> _______________________________________________
> ajdt-dev mailing list
> ajdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ajdt-dev