Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] declare @method syntax - is composite signature allowed??

Hi Andy,

Thanks for responding.  I tried the approach you are suggesting, unfortunately I'm getting the following:

java.lang.NullPointerException
at org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder.visit(AsmHierarchyBuilder.java:548)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:214)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1246)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(Compilatio ... oBuildJob.run(AutoBuildJob.java:238)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Compile error: NullPointerException thrown: null


Here's the aspect I'm using:

package com.citi.gdos.smart.applib.service.cache;

import org.springmodules.cache.annotations.Cacheable;

public aspect CachingIntroduction {

        declare @method: public * *..I*Dao+.set*(..): @Setter; declare @method: !@Setter public * *..I*Dao+.*(..):
                @Cacheable(modelId="fooModel");

}


Am I doing something wrong?  Do I need a nightly build perhaps for this to work?

Thanks,
Simeon

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
Sent: Tuesday, October 27, 2009 9:58 AM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] declare @method syntax - is composite signature allowed??

Hi Simeon,

This restriction you've uncovered was actually only recently raised as this enhancement:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=287613

To support it I need to change the serialized form of the attributes - I try not to do this often but for other reasons (optimization) I may be changing the format in 1.6.7 so I will be looking at it in that timeframe.

> declare @method :
>                public * *..I*Dao+.*(..) && !public * *..I*Dao+.set*(..):
>                        @Cacheable(modelId="fooModel");

a clunky approach might be:

declare @method: public * *..I*Dao+.set*(..): @Setter; declare @method: !@Setter public * *..I*Dao+.*(..):
@Cacheable(modelId="fooModel");

but I know that's not great...

Andy

2009/10/26 Leyzerzon, Simeon <simeon.leyzerzon@xxxxxxxx>:
> I have a hierarchy of DAO classes into which I'm introducing an @Cacheable annotation via something like this:
>
> declare @method :
>                public * *..I*Dao+.*(..) :
>                        @Cacheable(modelId="fooModel");
>
> The problem is, we need to filter out more than is specified by this one signature pattern, and I'm not sure that a composite pattern is allowed in this type of expression.  When I tried something like this:
>
> declare @method :
>                public * *..I*Dao+.*(..) && !public * *..I*Dao+.set*(..):
>                        @Cacheable(modelId="fooModel");
>
> I'm getting compile errors saying:
>
> Syntax error on token "&&", ";" expected
>
> I also tried to define composite pointcuts representing the joint points I'm interested in (basically I want to exclude 'jdbcTemplate' and 'slq' Spring specific setters from the places where annotation is introduced) but declaration syntax doesn't seem to like it either.
>
> What would be a good approach in the use case I described?
>
> I'm using compile time weaving via Ant.  AspectJ version is 1.6
>
> Thank you in advance,
> Simeon
>
> _______________________________________________
> 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


Back to the top