At the moment if you want to use 1.5
language features then you have to build your source with 'javac'. Command
line 'ajc' in the 1.5.0M1 build supports binary weaving of 1.5 classes
built with a 1.5 javac.
So, in your case, you might do something
like javac your source file that includes the @Override aspect and then
use the class files produced from that as input (using -inpath) to the
ajc compiler. Yes, its painful - can you imagine how painful it was
for us to write the testcases for the new features ?!?! :)
We have been waiting for the Eclipse
team to get their compiler to support 1.5 language features and then we
can rebase ajc on it. The Eclipse 3.1M4 compiler *does* support annotations
so we plan to move to this compiler level imminently - I imagine a 1.5.0
M2 would be available immediately after we have done this piece of work.
The '-1.5' flag you can pass to ajc
is not (currently) determining the source level, it is telling the weaver
whether to behave 'in a 1.5 way'. What does that mean? Well
with changes in Java5 we have changed some of the AspectJ rules. An example
would be the Java5 autoboxing behavior which you can find discussed in
the AspectJ 5 programmers notebook:
Basically, we have changed the rules
and allowed more types to be compatible and 'boxed' between- this can cause
your pointcuts to match more join points than they used to. As well
as offering the cool new stuff, we want AspectJ5 to support our existing
users working on Java 1.3/1.4 who won't be expecting any changes in behavior
- this is why when we make a change in the rules like this, we force the
user to activate the new behavior by specifying the '-1.5' flag.
cheers,
Andy.
---
Andy Clement
AspectJ Committer
clemas@xxxxxxxxxx
Russell Miles <russellmiles@xxxxxxx> Sent by: aspectj-users-admin@xxxxxxxxxxx
04/01/2005 14:19
Please respond to
aspectj-users@xxxxxxxxxxx
To
aspectj-users@xxxxxxxxxxx
cc
Subject
[aspectj-users] Problem compiling J2SE
5.0 source with ajc
Hi list,
A new year begins and I thought I'd have some fun putting the new J2SE
5.0 features of AspectJ through their paces. However, I've hit a snag on
the first attempt. I've got a dead simple class that uses the @Override
standard annotation to indicate/check that the toString() method is being
overridden properly. The class does nothing more apart from supplying a
main method that makes the call to toString() on a constructed object.
All works fine with javac but as soon as I try to use ajc I get:
Syntax error on tokens, delete these tokens
@Override
^^^^^
Ok, so this seems like something dumb that I've not done correctly on the
ajc command line so I checked out the help and added the -1.5 to the ajc
command line just in case ... to no avail. I even rooted through the generated
ajc script to see if there was anything odd but with no luck. Can someone
give me a push in the right direction as to what I'm doing wrong?
Cheers,
Russ
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users