[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] help please

Hi,

For the AspectJ 1.5.0 release, we are not planning to allow matching
upon parameter annotations, which is what you are using in your
program.  See the developers notebook here:

http://eclipse.org/aspectj/doc/next/adk15notebook/annotations-pointcuts-and-advice.html#d0e1421

which explains:

---
Package and Parameter Annotations

Note: A previous design allowed package annotation patterns to be
specified directly in type patterns, and parameter annotation patterns
to be specified directly in method and constructor signature patterns.
Because this made some pointcut expressions hard to read and
understand, we moved in favour of the design presented below, which
also has its drawbacks. Matching on package and parameter annotations
will be deferred until after the 1.5.0 release so that we can gain
more understanding of the kinds of uses AspectJ users are making of
annotations in pointcut expressions before commiting to any one
approach.
---

regards,
Andy.

On 13/07/05, Juraj Burian <jubu@xxxxxxxx> wrote:
> Hello anybody,
> 
> problem:
> Attribute Annotation does not match, respectively aspect is not applied.
> there are snippeds of code:
> 
> Annotation:
> @Target({CONSTRUCTOR, METHOD, FIELD, PARAMETER})
> @Retention(RetentionPolicy.RUNTIME)
> public @interface NotNull {
> }
> -----------------------------------------------------------------------------
> 
> 
> Aspect implementation :
> @Aspect
> public class NotNullAspect {
> 
>    @Before("execution(* *.*(@NotNull *, ..))")
>    public void runOnMethod(JoinPoint jp) throws NullPointerException {
>       ....
>    }
> }
> -----------------------------------------------------------------------------------
> 
> 
> Test implementation:
> public class annotationTestsCase extends TestCase {
>    public class TestDefinition {
>        void atributeTest(@NotNull final String x) {
>        }
>    }
> 
>    public void testAttributeMethod() throws Throwable {
>        TestDefinition test = new TestDefinition();
>        try {
>            test.atributeTest(null);
>            fail("Exception not occured!");
>        } catch (NullPointerException ex) {
>        }
>    }
> }
> 
> 
> Thank you
> for any advice,
> 
> regards
> J.Burian
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>