Skip to main content

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

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




Back to the top