[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [aspectj-users] Help: annotation introduction not working
|
- From: Andy Clement <andrew.clement@xxxxxxxxx>
- Date: Mon, 24 Aug 2009 13:54:06 -0700
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=YetOAesQ3fNNSt4JMOxxVd93O42PycmB5dUXOpO76wI=; b=ZLDHaBfpyHkzkzP9mMstlW4OQBYnBNJpAKcIju2EKJ6VyAt19F9Dh+gNSEs4Fvz4H4 RFZ/8kYsQ2S03fzdTcMHc6F3f7QDDNdrJaAv7x5G/owW7SDDbHdNJhIazCfE7i2zdbBo NKyTYP3z42fEYk7l8i+aqFDeiBopO28EsQAtY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=swmfrw6F6e5kQuEdlofFVqXuVBSvfyQAUzzVi761l1r8HaIS9ckY2Ld/pL0/TYOKuO g4V1heIPVqeueI2XDvI1tqBPlNPJ8Na6kWQ0ooqadHqg9wbRQHsuH2q3QJdpze2soIK0 mf+sLG5ZQgdw4Sv8hPFP6lzMx/g7e03rdqZnw=
I'm trying to recreate this locally but not having much luck. The
annotations are always there for me. You could try turning off
pipeline compilation in case that is affecting things - put
X="-Xset:pipelineCompilation=false" in your iajc command. But I'm not
hopeful that will address it as you are doing binary weaving. You are
on a recent AspectJ I take it?
Andy
2009/8/24 Matthew Adams <matthew@xxxxxxxxxxxxxxx>
>
> I'm using the ant task iajc to achieve some binary weaving of .class
> files, where I want to introduce not only fields and methods but also
> class-level annotations.
>
> The iajc compiler is emitting messages that say that it is adding the
> annotations, but when I decompile or use reflection against the woven
> classes, there are none on the class.
>
> Anyone know why this might be happening?
>
> Here is my iajc invocation (run from within maven-antrun-plugin):
> <iajc destDir="${project.build.outputDirectory}" source="1.6"
> target="1.6" debug="true" preserveAllLocals="true"
> showWeaveInfo="true" verbose="true" classpathref="cp" noimporterror="false">
> <sourceroots>
> <pathelement location="${project.build.sourceDirectory}" />
> <pathelement location="${project.build.sourceDirectory}/../aspect" />
> </sourceroots>
> <inpath>
> <pathelement location="${resource.entity.source.classes.path}" />
> </inpath>
> </iajc>
>
> Above, classpathref cp evaluates to a path that is
> maven.compile.classpath, and resource.entity.source.classes.path is
> the directory containing the .class files that I'm trying to weave.
>
> The ajc compiler says (package names abbreviated with "org...." to
> protect the innocent):
> [iajc] ajc [-source, 1.6, -verbose, -target, 1.6, -g, -d,
> C:\dev\ECO\svn\trunk\case\case-rest-resource-entity\target\classes,
> -showWeaveInfo, -preserveAllLocals, -classpath, ...
> ...
> [iajc] info Pipelining compilation
> ...
> [iajc] info weaver operating in reweavable mode. Need to verify
> any required types exist.
> ...
> [iajc] weaveinfo 'org.....rest.entity.Person' (Person.java) is
> annotated with @XmlRootElement type annotation from
> 'org.....rest.entity.aspects.RestResourceEntityMixin'
> (RestResourceEntityMixin.aj:14)
> [iajc] weaveinfo 'org.....rest.entity.Person' (Person.java) is
> annotated with @Generated type annotation from
> 'org.....rest.entity.aspects.RestResourceEntityMixin'
> (RestResourceEntityMixin.aj:13)
> [iajc] weaveinfo 'org.....rest.entity.User' (User.java) is
> annotated with @XmlRootElement type annotation from
> 'org.....rest.entity.aspects.RestResourceEntityMixin'
> (RestResourceEntityMixin.aj:14)
> [iajc] weaveinfo 'org.....rest.entity.User' (User.java) is
> annotated with @Generated type annotation from
> 'org.....rest.entity.aspects.RestResourceEntityMixin'
> (RestResourceEntityMixin.aj:13)
>
> Below is the aspect that's being applied. Note interestingly that
> while the @Generated and @XmlRootElements don't appear in the final
> woven .class file, the introduced fields and methods actually do show
> up.
>
> import org.....rest.entity.annotations.Generated;
> import javax.xml.bind.annotation.XmlRootElement;
>
> public aspect RestResourceEntityMixin {
>
> public static interface Introduced {}
>
> declare @type: (org.....rest.entity.*) : @Generated;
> declare @type: (org.....rest.entity.*) : @XmlRootElement;
>
> declare parents: (@Generated *) implements Introduced;
>
> private String Introduced.etag;
> private String Introduced.href;
>
> public String Introduced.getEtag() {
> return etag;
> }
> public void Introduced.setEtag(String etag) {
> this.etag = etag;
> }
>
> public String Introduced.getHref() {
> return href;
> }
> public void Introduced.setHref(String href) {
> this.href = href;
> }
> }
>
> Can anyone help?
>
> Thanks,
> Matthew
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users