Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Pertypewithin() and inner/nested type


Hi Ramnivas,

Based on the bug you raised and I just fixed to do with pertypewithin()
not matching inner types - there is now separate state for each
inner type (i.e. a separate aspect instance).  Wes suggested that
pertypewithin() is a shorthand for a slightly longer pointcut that
tells you what 'things' we create instances for, I think it is helpful
to think about it that way.  

Wes suggested pertypewithin(TypePattern) is short for

pertype(within(TypePattern) && (staticinitialization(*) || execution(static * *(..))))

So a join point that matches that pointcut will have an aspect instance associated
with its type - and so there is a new aspect instance per inner type too.

But the current implementation in AspectJ (as of this mornings dev build) is:

pertype(within(TypePattern) && staticinitialization(*))

There could be a free bug there for someone to raise if they can write
a program that demonstrates there is a problem in the gap between those two
pointcuts :)

Andy.




Ramnivas Laddad <ramnivas@xxxxxxxxxxxxxxx>
Sent by: aspectj-dev-admin@xxxxxxxxxxx

25/01/2005 22:18

Please respond to
aspectj-dev@xxxxxxxxxxx

To
aspectj-dev@xxxxxxxxxxx
cc
Subject
[aspectj-dev] Pertypewithin() and inner/nested type





How is pertypewithin() aspects state is associated with inner and nested
types?

On most occasion (especially logging a la log4j), inner types (but not
necessarily nested types -- declared using static) need to share the
per-type state with the outermost type. However, a direct interpretation
of pertypewithin() -- per type within (those matched by) the type
pattern -- will make one think that inner and nested state will have
*separate* state than the outer type.

This issue affects both pertype(Pointcut) or pertypewithin(TypePattern)
the same way (I think). Hence a separate email to avoid confusion.

-Ramnivas

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev


Back to the top