Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] EnsureAJBuilder.ensureNoJavaBuilder(..) and APT

Hi,

> I guess if the project is suitably
> configured, the java builder could be run in this way and then AspectJ
> used to build any resultant output.

That's exactly what I do. To be more precise I wanted to overcome ITD's
limitations. 
For instance you can't declare, as far as I know, that all types
annotated with @Clonable annotation (or any other type pattern) should
have method clone() returning the same type (that is method 
public Class1 Class1.clone() {...} ).
Therefore I decided to generate using APT a separate aspect for each
annotated type.

> I suppose it has limitations - a Java file can't refer to an aspect,
> since the java builder wouldn't be able to resolve the reference to an
> aj file. 

I haven't had to refer to aspect from generated files yet. Besides I
suppose the java builder is not very interested in a method's body when
it comes to an annotation processing. I noticed that any problems with
plain java code (like references to methods added by ITD that shouldn't
be recognised by Java compiler) are discarded by the AspectJ builder or
never raised by Java builder. As a result any problem markers that are
solved by the AspectJ builder aren't displayed.

> It is probably worth raising an enhancement request to track
> doing this - perhaps mentioning a bit more about the configuration and
> any limitations you see with the approach, so we can decide what to
> do.

The bug concerning AspectJ and APT cooperation was already raised - its
#169857. 

I raised a bug #278535 for EnsureAJBuilder.ensureNoJavaBuilder(..)
problem. I also attached to that bug a project that generates some files
using APT. 

Best regards
David



Back to the top