Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] getThis() caused stackoverflow

Hi Matthew,

here the simple aspect i am playing with... no specific aj-compiler option
used (guess default in eclipse)...

current versions:
eclipse: 3.0.1
jdk: 1.4.2.05

thanks,
Sandro

***********************************************************************

public aspect GeneralMethodTracer
{
      /** Logger named "ApplicationTracer" to log tracing data */
      private Logger logger =
LoggingFactory.getLogger("ApplicationTracer");

      /** Source-Safe-Revision-Number */
      public static final String    SS_VERSION_NUMBER       = "$Revision:
1.1 $";

      /** Source-Safe-Modified-Date */
      public static final String    SS_VERSION_MODTIME            = "$Date:
2005/01/11 12:41:24 $";

      /**
       * Pointcut to match the scope of packages for the advise.
       */
      pointcut traceClasses() :
            within(com.namics.common..*)
            && !within(com.namics.common.log*..*)
            && !within(com.namics.common.aop..*);

      /**
       * Pointcut to match the methods within the classes for the advise.
       */
      pointcut traceMethods() : traceClasses()
            && !within(GeneralMethodTracer)
            && (execution(* *.*(..)) || execution(*.new(..)))
            && !execution(String *.toString());

      before() : traceMethods()
      {
          if (logger.isInfoEnabled())
          {
                  logger.info("Entering ["
                              +
thisJoinPointStaticPart.getSignature().getDeclaringType().getName()
                              + "."
                              +
thisJoinPointStaticPart.getSignature().getName()
                              + "]"
                              + createParameterMessage(thisJoinPoint));
          }
      }

      after() : traceMethods()
      {
          if (logger.isInfoEnabled())
          {
                  logger.info("Leaving ["
                        +
thisJoinPointStaticPart.getSignature().getDeclaringType().getName()
                        + "."
                        + thisJoinPointStaticPart.getSignature().getName()
                        + "]");
          }
      }

    private String createParameterMessage(JoinPoint joinPoint)
    {
            Object[] arguments = joinPoint.getArgs();

            StringBuffer paramBuffer = new StringBuffer("\n\t[joinpoint: "
+ joinPoint);

//          paramBuffer.append("]\n\t[this: (" + joinPoint.getThis() +
")");
            paramBuffer.append("]\n\t[at location: (" +
joinPoint.getSourceLocation() + ")");
            paramBuffer.append("]\n\t[with args: (");

            for (int length = arguments.length, i = 0; i < length; ++i)
            {
                  Object argument = arguments[i];
                  paramBuffer.append(argument);
                  if (i != length-1)
                  {
                        paramBuffer.append(',');
                  }
            }

            paramBuffer.append(")]");
            return paramBuffer.toString();
    }
}



                                                                           
             Matthew Webster                                               
             <matthew_webster@                                             
             uk.ibm.com>                                                To 
             Sent by:                  aspectj-users@xxxxxxxxxxx           
             aspectj-users-adm                                          cc 
             in@xxxxxxxxxxx                                                
                                                                   Subject 
                                       Re: [aspectj-users] getThis()       
             17.01.2005 12:32          caused stackoverflow                
                                                                           
                                                                           
             Please respond to                                             
             aspectj-users@ecl                                             
                 ipse.org                                                  
                                                                           
                                                                           








Sandro,

Could you post the aspect and the compiler options you are using?

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

Sandro Ruch <sandro.ruch@xxxxxxxxxx>@eclipse.org on 17/01/2005 08:22:03

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:    aspectj-users-admin@xxxxxxxxxxx


To:    aspectj-users@xxxxxxxxxxx
cc:
Subject:    [aspectj-users] getThis() caused stackoverflow


hi all,

I'm relativly new to aop and aspectj in particular so i've played with some
basic aspect-examples.
it worked all fine till i've tried the getThis() method on the
JoinPoint-object. the call of this method has caused a
stackoverflow-exception...
all other method like getArgs(), etc. worked fine... just the getThis()
not... and i've defined something like && !within(GeneralMethodTracer) ..

can someone explain the deeper reason to me why this happens?

one further question to AspectJEditor... i've read in a mail of adrian (in
the archive) that the AspectJEditor will support the basic feature
of the standard JavaEditor inside eclipse (like organize imports,
refactoring methods like rename, etc.). When will this happen? Currently
i'm using version 1.2...

kind regards,
sandro

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


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




Back to the top