Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] What is the definition of "initialization" designator?

Hi,

	I am an AspectJ newbie. The initialization designator really
confused me.  Is there any difference between initialization( Class.new())
and execution( Class.new()) ?

In the following sample code:

public class Picture {

	private Vector graphs;
	static private Picture pic = null;

	private Picture(){
		this.graphs = new Vector();
	}


	public static Picture instanceOf(){

		if ( pic == null ){
			pic = new Picture();
			return pic;
		}
		else
			return pic;

	}

	public static void main( String [] args ){

		Picture p = Picture.instanceOf();
        }
}

Both initialization( new()) and execution( new()) worked well under
AspectJ 1.06 but got the following error message under AspectJ 1.1.1:

java.lang.ExceptionInInitializerError
	at Picture.<init>(Picture.java:23)
	at Picture.instanceOf(Picture.java:29)
	at Picture.main(Picture.java:39)
Caused by: org.aspectj.lang.NoAspectBoundException
	at Asp.aspectOf(Asp.java)
	at Asp.<init>(Asp.java:14)
	at Asp.ajc$postClinit(Asp.java)
	at Asp.<clinit>(Asp.java:14)
	... 3 more
Exception in thread "main"

Anybody can help to explain this? Thanks.



Back to the top