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 : )

This all boils down to Maven, it seems. It was, in fact the 1.6.7 tools jar. I thought the warning was the plugin just barking about expectations, not the compiler itself. I had never installed AspectJ outside Maven and our Maven setup was flawed. The 1.3 plugin hard-codes a version (1.6.7). The thing that threw me was that in Eclipse I was getting the same result.

I am now OK. Once I fixed the Maven stuff (modified the plugin POM just to force it to work for now), I got a clean result. Then I went back into Eclipse and it also worked. I am sure I cleaned out the classes directory before, but I am thinking maybe the decompiler had a file lock on the old JAR or something so it hung around and I was still seeing the Maven-built one. I'm just guessing, but at least I'm out of the woods.

Thanks for the help. Suggest you put a few words on the download site about alternative consumption in Maven and to be careful about the version in the current Maven plugin POM from codehaus.



Inactive hide details for Andy Clement ---11/09/2010 06:38:23 PM---> [WARNING] bad version number found in C:\.m2\org\aspectj\aAndy Clement ---11/09/2010 06:38:23 PM---> [WARNING] bad version number found in C:\.m2\org\aspectj\aspectjrt\1.6.10\aspectjrt-1.6.10.jar exp

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





> [WARNING] bad version number found in C:\.m2\org\aspectj\aspectjrt\1.6.10\aspectjrt-1.6.10.jar expected 1.6.7 found 1.6.10

That message does suggest you are using the 1.6.7 aspectjtools.jar (the compiler).  It is attempting to find the matching aspectjrt.jar (1.6.7) but finds 1.6.10 instead.  Is there not a 1.6.7 compiler lying around somewhere? Maybe delete 1.6.7 from your maven repo and see if it gets redownloaded?

Latest clean AJDT should be fine too as that includes early 1.6.11 dev builds.  The only time I would not expect it to work is if you are making ITDs onto an interface, rather than a class.

Andy

On 9 November 2010 14:00, <Christian.Hall@xxxxxxxxxxx> wrote:
    Here is what I've tried:

    I try building w/ Maven and the plugin says:
    [INFO] [aspectj:compile {execution: default}]
    [WARNING] bad version number found in C:\.m2\org\aspectj\aspectjrt\1.6.10\aspectjrt-1.6.10.jar expected 1.6.7 found 1.6.10


    I also for good measure downloaded the latest AJDT into a clean 3.6 Eclipse and built the project from there (no Maven).


    The dependency graph is a little large to try to do all this from the command line, but I can certainly set a JVM arg for verbose if you can suggest something. I usually use this in Eclipse to write the aspect and then compile w/ Maven, but I can try alternatives if it will help.


    I went and read the bug reports about this and it does look like this should just work. Trying to think how to isolate. I'll try to run your test. Wondering since you are using annotations if it somehow turns out different. By the way, I can take my example and strip out the annotation to be simply a private field and it still comes out public.


    I'll also try to run your example and see if it turns out right...that will narrow it to the scenario instead of the library version.





    Andy Clement ---11/09/2010 02:54:29 PM---Hi, The 1.6.10 jars are in our springsource repo - because I have direct access



    From:
    Andy Clement <andrew.clement@xxxxxxxxx>
    To:
    aspectj-users@xxxxxxxxxxx
    Date: 11/09/2010 02:54 PM

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





    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: 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;






        Christian.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


        To:
        aspectj-users@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.




        Andy 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
        https://dev.eclipse.org/mailman/listinfo/aspectj-users

        _______________________________________________
        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


    _______________________________________________
    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

GIF image


Back to the top