Hi,
I already posted to this list about issues with Java 5.0 and the avalon-meta Maven plugin.
I was thinking a bit about that and came to the conclusion, that making a new system which uses apt (Annotation Processing Tool) would actually be a very nice thing -- I'd also have the time to realise it. I see two major advantages in doing this:
1. This tool is part of Java since version 5.0 and provides a rather easy to use API for processing annotations and generating whatever out of the information in there. Because it's part of Java 5.0, it will probably continue working even if the Syntax is changed again, without having to adapt the code.
2. Annotations use Java expressions, which allows the IDE to help the programmer. E.g., instead of writing:
/** * @avalon.dependency type="my.package.MyService" */
you would write
import my.package.MyService; ... @Dependency(type = MyService.class)
This makes the declaration of dependencies and other things less error prone as both the IDE and the compiler will check these declarations for correctness to a certain extent. It also allows developres to use constants and other language features in meta info declarations, e.g.:
@Component(name="my-component", lifestyle=Lifestyle.SINGLETON) ...
or
public static final String CTX_PREFIX = "urn:avalon:my.package."; ... @Entry(name = CTX_PREFIX+"someValue") ...
So, what would it take to realise that? Actually, that wouldn't be too much work, I think. First of all, a set of AnnotationProcessors for these annotations would be needed to generate the meta files. I've seen that the code is very abstract and most of the work is already done and easily reusable. The current avalon-meta plugin and a new annotation based system could coexist peacefully.
The second part is a bit harder: Neither Ant nor Maven support apt yet, AFAIK. The easiest way to change this would probably be to make a new compiler plug-in, because apt can be used as full replacement of javac, it just needs/supports a few more options, the most important of which is -s <dir> (where to place generated files). Apart from that, the usage is just the same as for javac. If apt can be integrated with Ant and Maven (and I'm sure it will, it's only a question of time :), this would actually eliminate the need of a separate avalon-meta plugin: Just include avalon-meta-tools.jar into the classpath and the annotations would be processed.
Well, I'll have to talk to the developers of Ant and Maven about this. But I'd first like to read your general opinion, comments, thoughts, proposals. I also would first make a detailed proposal of the exact annotation definitions and post it to the developer's list for discussion.
cu, Raffi
-- raffael herzog software engineer
codeshack ag smart software solutions
hardstrasse 219, postfach 8037 zurich - switzerland
tel: +41 43 444 65 65 fax: +41 43 444 65 66
[EMAIL PROTECTED] www.codeshack.ch
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]