Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Problem dusting off old AspectJ project: abstract aspect fields not visible in subaspects?

I can't immediately see what is wrong.  If you can email me the whole
app I'll puzzle through it for you (and did you try a 1.6.10?)

cheers
Andy

On 5 May 2011 05:38, Matthew Adams <matthew@xxxxxxxxxxxxxxx> wrote:
> Hi all,
>
> I'm blowing the dust off of an old AspectJ-based project I had been
> working on, and I'm getting an error that I can't quite figure out.  I
> have an abstract aspect that is introducing two Date fields.  Various
> subaspects (4 of them) are attempting to access the field, but the
> compiler is saying that the field is not visible.  I've included
> relevant info below.  Anyone have an idea why this wouldn't work?  I'm
> using Maven 2.2.1, JDK 1.6.0_25, and trying to use AspectJ 1.6.11 &
> aspectj-maven-plugin 1.3.1.
>
> ...
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] ------------------------------------------------------------------------
> [INFO] Compiler errors:
> error at datetimePersisted = new Date();
> ^^^^^^^^^^^
> C:\Work\...\trunk\domain-model\src\main\aspect\me\matthewadams\my\project\name\aspects\PersistentlyAuditableAdvisingPrePersistMixin.aj:18:0::0
> datetimePersisted cannot be resolved
> error at datetimeUpdated = new Date();
> ^^^^^^
> C:\Work\...\trunk\domain-model\src\main\aspect\me\matthewadams\my\project\name\aspects\PersistentlyAuditableAdvisingPrePersistMixin.aj:19:0::0
> datetimeUpdated cannot be resolved
> error at datetimeUpdated = new Date();
> ^^^^^^^^^^^^^
> C:\Work\...\trunk\domain-model\src\main\aspect\me\matthewadams\my\project\name\aspects\PersistentlyAuditableAdvisingPreUpdateMixin.aj:18:0::0
> datetimeUpdated cannot be resolved
> error at datetimePersisted = datetimeUpdated = new Date();
> ^^^^^^^^^^^^^^^
> C:\Work\...\trunk\domain-model\src\main\aspect\me\matthewadams\my\project\name\aspects\PersistentlyAuditableIntroducingPrePersistMixin.aj:13:0::0
> The field AbstractPersistentlyAuditableMixin.IntroducedPersistentlyAuditable.datetimePersisted
> is not visible
> error at datetimePersisted = datetimeUpdated = new Date();
>                    ^^^^^^^^^^^^^
> C:\Work\...\trunk\domain-model\src\main\aspect\me\matthewadams\my\project\name\aspects\PersistentlyAuditableIntroducingPrePersistMixin.aj:13:0::0
> The field AbstractPersistentlyAuditableMixin.IntroducedPersistentlyAuditable.datetimeUpdated
> is not visible
> error at datetimeUpdated = new Date();
> ^^^^^^^^^^^^^
> C:\Work\...\trunk\domain-model\src\main\aspect\me\matthewadams\my\project\name\aspects\PersistentlyAuditableIntroducingPreUpdateMixin.aj:14:0::0
> The field AbstractPersistentlyAuditableMixin.IntroducedPersistentlyAuditable.datetimeUpdated
> is not visible.
>
>
> Here's the abstract aspect:
>
>
> public abstract aspect AbstractPersistentlyAuditableMixin {
>
>    public interface IntroducedPersistentlyAuditable extends
>            PersistentlyAuditable {
>    }
>
>    @Column(name = "datetimePersisted")
>    private Date
> AbstractPersistentlyAuditableMixin.IntroducedPersistentlyAuditable.datetimePersisted;
>
>    @Column(name = "datetimeUpdated")
>    private Date
> AbstractPersistentlyAuditableMixin.IntroducedPersistentlyAuditable.datetimeUpdated;
>
>    public Date
> AbstractPersistentlyAuditableMixin.IntroducedPersistentlyAuditable.getDatetimePersisted()
> {
>        return new Date(datetimePersisted.getTime());
>    }
>
>    public Date
> AbstractPersistentlyAuditableMixin.IntroducedPersistentlyAuditable.getDatetimeUpdated()
> {
>        return new Date(datetimeUpdated.getTime());
>    }
> }
>
>
> Here's one of the subaspects:
>
>
> public aspect PersistentlyAuditableAdvisingPrePersistMixin extends
> AbstractPersistentlyAuditableMixin {
>
>    declare parents : ((@Entity *) && hasmethod(@PrePersist * *(..)))
> implements IntroducedPersistentlyAuditable;
>
>    after() returning : execution(@PrePersist * *(..)) {
>            datetimePersisted = new Date();
>        datetimeUpdated = new Date();
>    }
> }
>
> I'm using maven 2.2.1 with the aspectj-maven-plugin 1.3.1.  Here are
> the relevant portions of my pom:
>
> ...
>        <!-- maven properties -->
>        <my-project-name.aspectj.version>1.6.11</my-project-name.aspectj.version>
>        <my-project-name.aspectj.maven.plugin.version>1.3.1</my-project-name.aspectj.maven.plugin.version>
> ...
>            <dependency>
>                <groupId>org.aspectj</groupId>
>                <artifactId>aspectjrt</artifactId>
>                <version>${my-project-name.aspectj.version}</version>
>            </dependency>
>            <dependency>
>                <groupId>org.aspectj</groupId>
>                <artifactId>aspectjweaver</artifactId>
>                <version>${my-project-name.aspectj.version}</version>
>            </dependency>
>            <dependency>
>                <groupId>org.aspectj</groupId>
>                <artifactId>aspectjtools</artifactId>
>                <version>${my-project-name.aspectj.version}</version>
>            </dependency>
> ...
>                <plugin>
>                    <groupId>org.codehaus.mojo</groupId>
>                    <artifactId>aspectj-maven-plugin</artifactId>
>
> <version>${my-project-name.aspectj.maven.plugin.version}</version>
>                    <configuration>
>                        <verbose>true</verbose>
>                        <complianceLevel>1.5</complianceLevel>
>                        <XhasMember>true</XhasMember>
>                    </configuration>
>                    <executions>
>                        <execution>
>                            <goals>
>                                <goal>compile</goal>
>                                <goal>test-compile</goal>
>                            </goals>
>                        </execution>
>                    </executions>
>                </plugin>
> ...
>
> Thanks,
> Matthew
>
> --
> @matthewadams12
> mailto:matthew@xxxxxxxxxxxxxxx
> skype:matthewadams12
> yahoo:matthewadams
> aol:matthewadams12
> google-talk:matthewadams12@xxxxxxxxx
> msn:matthew@xxxxxxxxxxxxxxx
> http://matthewadams.me
> http://www.linkedin.com/in/matthewadams
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top