Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Are static initializers of an aspect guaranteed to be called?

In this regard, aspects behave just like classes. When an aspect type is referenced for the first time, its static initializer will be called just as for a class.

-Ramnivas

On Tue, Feb 16, 2010 at 10:33 AM, Gary Bisaga <gbisaga@xxxxxxxxx> wrote:
I read (for example in AspectJ in Action) it emphasized that while an
aspect is in many ways like a class, an aspect is *not* a class. What
I would like to do is to write a static initializer block for my aspect:

public aspect MyAspect {
 private static SomeClass myObject;
 static {
  myObject = new SomeClass (...);
 }
}

Here is my question: is my static initializer guaranteed to be called
when the aspect is loaded? For that matter, are aspects loaded via
normal ClassLoaders? Thanks.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top