Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Performance problem with @annotation(x) on field access

Hi,

some time ago there was a bug report about slow performance with
@annotation on method level:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=296484

I want to report a similar issue with the @annotation on field access level.

Using something like the following advice which captures the use of a
@Bind-annotation on field set access results in poor performance:

	Object around(Object host, Bind bind, Object newGuest)
	: set(@Bind !java.util.Collection+ *.*)
			&& this(host) && args(newGuest) && @annotation(bind)
	{		
                // ...
		return proceed(host, bind, newGuest);
	}

A workaround similar to the one descirbed in the bug reports performs
much better:

	Object around(Object host, Object newGuest)
	: set(@Bind !java.util.Collection+ *.*)
		&& this(host) && args(newGuest)
	{		
		Bind bind = ((FieldSignature)
thisJoinPointStaticPart.getSignature()).getField().getAnnotation(Bind.class);
                // ...
		return proceed(host, newGuest);
	}

HTH, Maik


Back to the top