Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] semantics of thisEnclosingJoinPointStaticPart

My understanding is that what tEJPSP is about is that "enclosing" means
"lexically enclosing", And "static" just means the same as in joinPointStaticPart.

So its theStaticPartOf(theLexicallyEnclosingJoinPointOf(thisJoinPoint)).
Just as tJSP is theStaticPartOf(thisJoinPoint).


>    Implementations may vary in the static analysis to
>    deduce enclosing join points, and are not required
>    to evaluate scopes beyond the currently enclosing

Given that understanding, I don't think there should be implementation variability
here.


> -----Original Message-----
> From: aspectj-dev-admin@xxxxxxxxxxx 
> [mailto:aspectj-dev-admin@xxxxxxxxxxx] On Behalf Of Wes Isberg
> Sent: Tuesday, October 07, 2003 3:22 PM
> To: aspectj-dev@xxxxxxxxxxx
> Subject: [aspectj-dev] semantics of thisEnclosingJoinPointStaticPart
> 
> 
> The programming guide says,
> 
>    thisEnclosingJoinPointStaticPart is bound to the static
>    part of the join point enclosing the current join point.
> 
> Is it correct (and helpful) to say this?:
> 
>    thisEnclosingJoinPointStaticPart is bound to the static
>    part of the join point which can be staticly determined
>    to enclose the current join point.
> 
> If not also:
> 
>    For example, if a
>    method call site is in the body of a constructor, then
>    the method call join point will have as its enclosing
>    join point the constructor execution join point.  If
>    the enclosing join point cannot be staticly determined,
>    then thisEnclosingJoinPointStaticPart will be the same
>    as thisJoinPointStaticPart.
> 
> and in the limitations appendix:
> 
>    Implementations may vary in the static analysis to
>    deduce enclosing join points, and are not required
>    to evaluate scopes beyond the currently enclosing
>    scope of the join point or to include implicit
>    invocations resulting from instantiating instances
>    or classes.
> 
> I guess this is supposed to work when the enclosing join point
> is method or constructor execution or {static} initialization
> and the join point is a handler, a method or constructor call,
> or a field get or set?  Any other times?
> 
> If so, we might document e.g., that a method-call is
> not necessarily the enclosing join point of a method-
> execution.
> 
> Thanks -
> Wes
> 
> ---- output
> 
>       tjp: staticinitialization(AdviceExecution.<clinit>)
>       ejp: staticinitialization(AdviceExecution.<clinit>)
>       tjp: execution(void AdviceExecution.main(String[]))
>       ejp: execution(void AdviceExecution.main(String[]))
>         tjp: call(C())
>         ejp: execution(void AdviceExecution.main(String[]))
>           tjp: staticinitialization(C.<clinit>)
>           ejp: staticinitialization(C.<clinit>)
>           tjp: initialization(C())
>           ejp: initialization(C())
>           tjp: execution(C.<init>)
>           ejp: execution(C.<init>)
>           tjp: execution(C())
>           ejp: execution(C())
>         tjp: initialization(A())
>         ejp: initialization(A())
>         tjp: execution(A.<init>)
>         ejp: execution(A.<init>)
>         tjp: execution(A())
>         ejp: execution(A())
>         tjp: staticinitialization(A.<clinit>)
>         ejp: staticinitialization(A.<clinit>)
>         tjp: execution(ADVICE: void A.before())
>         ejp: execution(ADVICE: void A.before())
>           tjp: call(void A.m())
>           ejp: execution(ADVICE: void A.before())
>             tjp: execution(void A.m())
>             ejp: execution(void A.m())
>               tjp: call(java.lang.Error(String))
>               ejp: execution(void A.m())
>           tjp: handler(catch(Error))
>           ejp: execution(ADVICE: void A.before())
>           tjp: call(void A.log(Error))
>           ejp: execution(ADVICE: void A.before())
>             tjp: execution(void A.log(Error))
>             ejp: execution(void A.log(Error))
>               tjp: get(PrintStream java.lang.System.out)
>               ejp: execution(void A.log(Error))
>               tjp: call(String java.lang.Throwable.getMessage())
>               ejp: execution(void A.log(Error))
>               tjp: call(void java.io.PrintStream.println(String))
>               ejp: execution(void A.log(Error))
> Error: catch me if you can
>         tjp: call(void C.run())
>         ejp: execution(void AdviceExecution.main(String[]))
>           tjp: execution(void C.run())
>           ejp: execution(void C.run())
> 
> ---- program
> 
> import java.io.PrintStream;
> import org.aspectj.lang.JoinPoint;
> 
> public class AdviceExecution {
>      public static void main(String[] args) {
>          new C().run();
>      }
> }
> 
> class C { void run() {} }
> 
> aspect A {
>      before() : call(* *(..))
>          && !call(void A.m())
>          && !call(void A.log(Error))
>          && !withincode(void A.log(Error))
>          && JoinPointLogger.safety() {
>          try {
>            m();
>          } catch (Error e) {
>              log(e);
>          }
>      }
>      void  m() { throw new Error("catch me if you can");}
>      void  log(Error e) {
>              System.out.println("Error: " + e.getMessage());
>      }
> }
> 
> aspect JoinPointLogger {
>      final String tab = "  ";
>      final StringBuffer tabs = new StringBuffer();
> 
>      pointcut safety() : !within(JoinPointLogger);
>      pointcut aroundsafety() : !(initialization(*.new(..))
>          || handler(*)
>          //|| preinitialization(*.new(..))
>          );
> 
> 
>      before() : within(*) && safety() {
>          System.out.println(tab + tabs
>              + "   tjp: "
>              + thisJoinPoint.toString());
>          System.out.println(tab + tabs
>              + "   ejp: "
>              + thisEnclosingJoinPointStaticPart.toString());
>      }
> 
>      /** identify all join points */
>      Object around() : within(*) && safety() && aroundsafety() {
>          final int len = tabs.length();
>          tabs.append(tab);
>          try {
>              return proceed();
>          } finally {
>              tabs.setLength(len);
>          }
>      }
> }
> 
> 
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-dev
> 




Back to the top