Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ajdt-dev] Args evaluation in non-proceeding around()

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.




Back to the top