Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] annotation on ITD field gets lost...must be user error : )

Hi, 

The 1.6.10 jars are in our springsource repo - because I have direct access to put it in there.  It isn't in central as I have to go via another route (using a kind aspectj-user's machine) to get it in there.  If you want it from our maven:

<repository>
    <id>maven.springframework.org</id>
    <name>SpringSource releases</name>
    <url>http://maven.springframework.org/release</url>
</repository>

Artifact will be 1.6.10.RELEASE (not just 1.6.10 like it is in central)
Here is my program:

---- A.java ---
import java.lang.annotation.*;
public class A {
}

@Retention(RetentionPolicy.RUNTIME)
@interface Anno {}

aspect X {
  @Anno
  private int A.newField;
}
-------

ajc -1.5 A.java
javap -private -verbose A
private int newField;
  RuntimeVisibleAnnotations: length = 0x6
   00 01 00 10 00 00

So one annotation with name at 0x10 in the constant pool:
const #16 = Asciz       LAnno;;

The fact that your field is not private and that you have the ajcITD annotation suggests you are running an old version of AspectJ.  The changes to remove ajcITD and to maintain visibility were actually made in 1.6.9 (I just double checked http://www.eclipse.org/aspectj/doc/released/README-169.html) - and compiling that program with 1.6.9 also gives me the same result.  If I go back to 1.6.8 I get the same result as you.

Can you turn on some verbose flag to get it to print the version of AspectJ in use during your build?

Andy.

On 9 November 2010 06:12, <Christian.Hall@xxxxxxxxxxx> wrote:

OK, I just got a clue and see that the JAR is an installer. Sorry for the noise. Still curious about Maven updates.

But the big concern I have is that even w/ 1.6.10, the field comes out public.

@Embedded
private TestEmbeddable Target.testEmbeddable;

Gives...

@Embedded
@ajcITD(targetType="mypackage.Target", name="testEmbeddable", modifiers=2)
public TestEmbeddable ajc$interField$mypackage_TestIntroductions$testEmbeddable;





Inactive hide details for Christian.Hall---11/09/2010 08:50:14 AM---Turns out that having that field be public may be the reasoChristian.Hall---11/09/2010 08:50:14 AM---Turns out that having that field be public may be the reason the JPA stuff I'm attempting isn't work

From: Christian.Hall@xxxxxxxxxxx

Date: 11/09/2010 08:50 AM

Subject: Re: [aspectj-users] annotation on ITD field gets lost...must be user error : )
Sent by: aspectj-users-bounces@xxxxxxxxxxx





Turns out that having that field be public may be the reason the JPA stuff I'm attempting isn't working. I'll download 1.6.10 and manually patch my classpath in hopes that this bug is fixed, but can you comment on the Maven delivery? For one thing, the downloaded JAR is just that, a single JAR, while in Maven, it shows up as separate RT and weaver JARs. We can manually deploy into our Maven repo, but this discrepancy has me wondering.


----- Forwarded by Christian Hall/Technology/Equifax on 11/09/2010 08:46 AM -----


From:
Christian Hall/Technology/Equifax
To:
aspectj-users@xxxxxxxxxxx
Date:
11/06/2010 07:55 AM
Subject:
Re: [aspectj-users] annotation on ITD field gets lost...must be user error : )



Yep. We were using a very old version (1.5.4)...mostly due to the fact that mavenrepository.org is where we used to look up Maven locations for things. You moved a while back to org.aspectj which we didn't follow. The Maven repo information would be a good thing to put on the download or release announcement pages as once I started looking, it was tough to find where it now lives in Maven Central. Looks like 1.6.9 is the latest in Maven Central.


I'm seeing the annotation in there now but the field is still public. Maybe that was a 1.6.10 change. This should un-stick me anyway. Thanks for the quick response.



Inactive hide details for Andy Clement ---11/05/2010 05:47:38 PM---Hi, If the field is private then you must be on an old versiAndy Clement ---11/05/2010 05:47:38 PM---Hi, If the field is private then you must be on an old version of AspectJ - for

From:
Andy Clement <andrew.clement@xxxxxxxxx>
To:
aspectj-users@xxxxxxxxxxx
Date:
11/05/2010 05:47 PM
Subject:
Re: [aspectj-users] annotation on ITD field gets lost...must be user error : )
Sent by:
aspectj-users-bounces@xxxxxxxxxxx




Hi,

If the field is private then you must be on an old version of AspectJ - for the last couple of releases private ITDs like that create private fields in the target.  I do recall a bug with annotated ITDs and the annotations not making it through - I just tried it (on 1.6.10) and it works as expected for me.  Can you try on a more recent version or AspectJ/AJDT?

Andy

On 5 November 2010 09:05, <Christian.Hall@xxxxxxxxxxx> wrote:

      Maybe this is just not possible, but I am introducing a field on a class and want it to also have an annotation.

      public aspect ExampleAspect {

      @Embedded
      private SomeType TargetClass.introducedField;

      }

      Decompiling shows the field woven, but it is not annotated. The field is also public, but I suspect that is just the way things work.

      Do I have to separately introduce the annotation using declare on my introduced field?

      This message contains information from Equifax Inc. which may be confidential and privileged. If you are not an intended recipient, please refrain from any disclosure, copying, distribution or use of this information and note that such actions are prohibited. If you have received this transmission in error, please notify by e-mail postmaster@xxxxxxxxxxx.

      _______________________________________________
      aspectj-users mailing list
      aspectj-users@xxxxxxxxxxx
      https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx

https://dev.eclipse.org/mailman/listinfo/aspectj-users


This message contains information from Equifax Inc. which may be confidential and privileged. If you are not an intended recipient, please refrain from any disclosure, copying, distribution or use of this information and note that such actions are prohibited. If you have received this transmission in error, please notify by e-mail postmaster@xxxxxxxxxxx._______________________________________________


aspectj-users mailing list
aspectj-users@xxxxxxxxxxx


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top