Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] [Fwd: Re: [aspectj-users] newbie question - got around on initialization not supported error...]

Erik -

fyi, I changed the limitations appendix of the Programming Guide
to add the caveat for around advice on initializations:

----
The end of an exception handler is underdetermined in bytecode,
so ajc will not implement after or around advice on handler join
points.  Similarly, ajc cannot implement around advice on
initialization or preinitialization join points.  In cases where
ajc cannot implement advice, it will emit a compile-time error
noting this as a compiler limitation.
----

If that limitation will be removed in a 1.1.X release, we can
instead log the caveat as an "info" bug.

Wes

-------- Original Message --------
Subject: Re: [aspectj-users] newbie question - got around on initialization not supported error...
Date: Tue, 15 Jul 2003 10:49:35 -0700
From: Wes Isberg <wes@xxxxxxxxxxxxxx>
Reply-To: aspectj-users@xxxxxxxxxxx
To: aspectj-users@xxxxxxxxxxx
References: <20030715171248.1382D23F86@xxxxxxxxxxxxxxx>

Hi -

I got a bunch of errors:

D:\Projects\mj\src\mjaop\com\mediajunkies\aspect\dev\Test.java:25
around on
initialization not supported (compiler limitation)

ajc is directing you to one of its limitations: it can't
implement around advice on {pre-}initialization join points.
(If/since this is the case, we should document it in the
semantics appendix of the Programming Guide, as the
handler case is.)

If you don't know why it's picking out those join points,
most likely you have a pointcut that picks out a bunch of
join points for your around advice, e.g.,

   Object around() : within(MyClass) {
      System.out.println("start!" + thisJoinPoint);
      try {
	return proceed();
      } finally {
          System.out.println("end!" + thisJoinPoint);
      }
   }

You can exclude {pre-}initialization and handler join points
as follows:

   Object around() : within(MyClass)
          && !initialization(MyClass.new(..))
          && !preinitialization(MyClass.new(..))
          && !handler(*) {
       ...

Or you can re-write the pointcut to pick out other kinds
of join points.

Thanks for bringing this up -
Wes

edgaryip@xxxxxxxxxxx wrote:
Hi All,

I just started using AspectJ a week ago...tried out all the example.

When I try to use it in my project using iajc with ant, my ant setting is:

<target name="compilej" depends="resources,init">
  <iajc destdir="${build}"
	failonerror="off"
	argfiles="${mjaopSrc}/dev.lst"
	proceedonerror="on"
	verbose="off">
	<srcdir>
	  <pathelement path="${mjfSrc}" />
	  <pathelement path="${mjappSrc}" />
	</srcdir>
	<classpath>
	  <fileset dir="${build.classpath}" >
	    <include name="**/*.jar" />
	    <include name="**/*.zip" />
	  </fileset>
	</classpath>
  </iajc>
 </target>


I got a bunch of errors:

D:\Projects\mj\src\mjaop\com\mediajunkies\aspect\dev\Test.java:25 around on initialization not supported (compiler limitation) D:\Projects\mj\src\mjaop\com\mediajunkies\aspect\dev\Test.java:19 around on initialization not supported (compiler limitation)
D:\Projects\mj\src\mjaop\com\mediajunkies\aspect\dev\Test.java:25 around on pre-
initialization not supported (compiler limitation)
D:\Projects\mj\src\mjaop\com\mediajunkies\aspect\dev\Test.java:19 around on pre-
initialization not supported (compiler limitation)
D:\Projects\mj\src\mjaop\com\mediajunkies\aspect\dev\Test.java:25 around on initialization not supported (compiler limitation)
D:\Projects\mj\src\mjf\com\mediajunkies\appkit\dnd\datatransfer\EOGlobalKey.java
:7 around on initialization not supported (compiler limitation)
...

Am I missing something?

Thanks
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users





Back to the top