Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] [aspect-users] Static initialization with JDK 1.5 annotation

Hi all,

I'm currently trying to match static initialization of objects with annotation.

I try this

	public aspect StaticInit {

		after() : staticinitialization(@Entity test.*) {
			System.out.println(thisJoinPoint.getSignature().toString());
		}
	}

If I execute this aspect on source code :

	@Entity
	public class A {}
and
	public class B {
		public static void main(String[] args) {
			A a = new A();
		}
	}

I obtain

	B.<clinit>
	A.<clinit>

I don't understand why my aspect match B initialization whereas this object does not have the annotation.

Is this a bad writing ? If so, what is the good writing ?

Thanks,

Mickaël RIFFLARD
Atos Origin



Back to the top