Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] thisJoinPoint.getThis() documentation

Hello all,

I'm trying to understand the reason for this behavior though it is working
as documented....  I am running some code in a join point that occurs in an
object that must be instantiated.  The method that is getting intercepted
is not a static method but the caller is a static method in some cases but
not in others.  In the case where the caller is a static method,
thisJoinPoint.getThis() returns null (as documented).  It seems that the
getThis() should be able to return the object in use even if called by a
static method if the method itself is not static.  However this is not the
case as documented.  Any reason why since the object must be instantiated
within the static method and therefore this is a currently executing real
object?  Doesn't the byte code weaving just insert/pass a "this" reference
which would be valid in java?  Makes sense for a static method but not sure
why it's the case for a static method calling objects.  I am running in
threads from a J2EE app server presently, but does this mean that if I have
a plain java application which start from a "public static String(String[]
args)" I would never be able to use getThis() after the program starts
unless I spawn new threads?

I would appreciate any insight into why this is the case or if it really
needs to be the case (ie. can this be a feature request?).

Thanks...djsuarez




************************************************************************
 This E-mail is confidential. It may also be legally privileged. If you
 are not the addressee you may not copy, forward, disclose or use any
 part of it. If you have received this message in error, please delete
 it and all copies from your system and notify the sender immediately
 by return E-mail.

 Internet communications cannot be guaranteed to be timely, secure,
 error or virus-free. The sender does not accept liability for any
 errors or omissions.
************************************************************************


Back to the top