Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] @args pointcut advice not working

Hi all,

I have tried the following snippet of code:

public class T {
  public void f(@Length(min = 0, max = 1) String s1) {

  public static void main(String[] args) {
    T t = new T();

public aspect A {
  private pointcut lengthParam1(final Object parameter, final Length length) :
    execution(* *(@Length (*), ..)) &&
    args(parameter, ..) &&
    @args(length, ..);

  before(final Object parameter, final Length length) :
    lengthParam1(parameter, length) {
    enforce(thisJoinPoint, thisEnclosingJoinPointStaticPart, parameter,
    length, 1);

  private void enforce(org.aspectj.lang.JoinPoint joinPoint,
    org.aspectj.lang.JoinPoint.StaticPart enclosingJoinPoint,
    Object parameter, Length length, int parameterNumber) {
    System.out.println("Do something...");

But no advice is executed. Is this a bug or am I missing something?

Kind regards,

Paulo Zenida

Back to the top