Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Aspect generated property naming convention.

Hi Andy,

Thank you very much for your explication.

Salutations.

Jean-Jacques.

Le 24/01/2013 18:36, Andy Clement a écrit :
Hi,

It is only a recent thing that you have the ability to have 'non mangled' names for the generated elements. Originally all names were mangled because the principal design was that you are expressing new members that are private 'with respect to the aspect' - so they are for the aspects use and the user code doesn't want to know they are there - if they are mangled then the user code is very unlikely to trip over them. However, more and more users wanted to use the pattern to add private members to types and not have them mangled.  The first round of changes made this work for ITDs on classes. The second round of changes handled this for ITDs on interfaces - under https://bugs.eclipse.org/bugs/show_bug.cgi?id=73507 - this was in AspectJ 1.7.1.  The older naming scheme can be 'forced' by using -Xset:itdVersion=1 - that will ensure all names are mangled like they used to be and is primarily still in the code for compatibility reasons (if you had legacy code that had certain expectations). There is no option to force the new naming scheme, it should be the default.

Your maven shows you as using 1.6.11 - you should probably update to 1.7.1. It may be that the builds in eclipse are using the new naming scheme whilst your maven builds are using the old naming scheme.

cheers,
Andy




On 23 January 2013 01:46, Jean-Jacques Peyronel <jjpeyronel@xxxxxxxxxxxxxx> wrote:
Hi all,

We have 2 maven projects (A and B).

A declare some class as a,b,c
We use aspect to inject private properties as

interface i{
}

declare parents: a,b,c implements i;

@annotation
I.p1;

The following illustration is with the same aspect.

Sometimes the names of the properties are :
a.p1 b.p1 c.p1
Sometimes the names of the properties are :
a.ajc$interField$package_aspect$package_aspect$aspect$a

In eclipse when project A is open, the names are a.p1 b.p1 c.p1 in the
point of view B dependencies.
if I close A, names in my dependancies tree are
a.ajc$interField$package_aspect$package_aspect$aspect$p1.

How can I always use a.p1 b.p1 c.p1 form ?

I saw on internet that private properties can change her real name after
aspect compilation, but are there a way to force naming convention ?
In the maven pluggin, I don't see any option about that.
If naming conflicts force the ajc compiler to change naming convention,
how could I see the property cause ?
When the ajc changes the naming strategy ?
Sometime maven (mvn clean install) generate simple name and sometime no.
Have you an idea about some option or parameter we must check for ?

My aspectJ maven compilation configuration for A is :
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>1.4</version>
        <executions>
          <execution>
            <phase>process-sources</phase>
            <goals>
              <goal>compile</goal>
              <goal>test-compile</goal>
            </goals>
            <configuration>
              <outxml>true</outxml>
              <preserveAllLocals>true</preserveAllLocals>
              <repeat>2</repeat>
              <aspectLibraries>
                <aspectLibrary>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-aspects</artifactId>
                </aspectLibrary>
              </aspectLibraries>
              <source>1.6</source>
              <target>1.6</target>
              <complianceLevel>1.6</complianceLevel>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.6.11</version>
            <scope>compile</scope>
          </dependency>
          <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
            <version>1.6.11</version>
            <scope>compile</scope>
          </dependency>
        </dependencies>
        <configuration>
          <outxml>true</outxml>
          <preserveAllLocals>true</preserveAllLocals>
          <repeat>2</repeat>
          <aspectLibraries>
            <aspectLibrary>
              <groupId>org.springframework</groupId>
              <artifactId>spring-aspects</artifactId>
            </aspectLibrary>
          </aspectLibraries>
          <source>1.6</source>
          <target>1.6</target>
          <complianceLevel>1.6</complianceLevel>
        </configuration>
    </plugin>
      <plugin>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>2.7</version>
        <configuration>
          <downloadSources>true</downloadSources>
          <downloadJavadocs>false</downloadJavadocs>
          <wtpversion>2.0</wtpversion>
          <additionalBuildcommands>
            <buildCommand>
              <name>org.eclipse.ajdt.core.ajbuilder</name>
              <arguments>
                <aspectPath>org.springframework.aspects</aspectPath>
              </arguments>
            </buildCommand>
            <buildCommand>

<name>org.springframework.ide.eclipse.core.springbuilder</name>
            </buildCommand>
          </additionalBuildcommands>
          <additionalProjectnatures>
            <projectnature>org.eclipse.ajdt.ui.ajnature</projectnature>

<projectnature>com.springsource.sts.roo.core.nature</projectnature>

<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
          </additionalProjectnatures>
        </configuration>
      </plugin>

Thanks.

_______________________________________________
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
begin:vcard
fn:Jean-Jacques Peyronel
n:Peyronel;Jean-Jacques
org:TOWA France;Informatique
adr:Ch de la bastide blanche;;Parc GVIO Bat A5;Vitrolles;;13127;France
email;internet:jjpeyronel@xxxxxxxxxxxxxx
title;quoted-printable:D=C3=A9veloppeur
tel;work:04 42 34 01 37
tel;fax:04 42 34 01 45
url:http://www.towa-france.fr
version:2.1
end:vcard

Attachment: signature.asc
Description: OpenPGP digital signature


Back to the top