]> source.dussan.org Git - aspectj.git/commitdiff
fix for pr104220 - poor toString implementations for adviceexecution join points.
authoracolyer <acolyer>
Tue, 8 Nov 2005 18:12:37 +0000 (18:12 +0000)
committeracolyer <acolyer>
Tue, 8 Nov 2005 18:12:37 +0000 (18:12 +0000)
lib/aspectj/lib/aspectjrt.jar
lib/test/aspectjrt.jar
runtime/src/org/aspectj/lang/JoinPoint.java
runtime/src/org/aspectj/runtime/reflect/AdviceSignatureImpl.java
runtime/src/org/aspectj/runtime/reflect/StringMaker.java

index f84818173e01cfc225d43264f565dc26a2a05b64..6ef865ea7980063049eaab4d1086b380d30d3d7c 100644 (file)
Binary files a/lib/aspectj/lib/aspectjrt.jar and b/lib/aspectj/lib/aspectjrt.jar differ
index f84818173e01cfc225d43264f565dc26a2a05b64..6ef865ea7980063049eaab4d1086b380d30d3d7c 100644 (file)
Binary files a/lib/test/aspectjrt.jar and b/lib/test/aspectjrt.jar differ
index 5640786bae924cbe274df3fa357378fe09f1802e..a32e995cc4b1cf50ce8f1ea07f225d03189ce6a4 100644 (file)
@@ -177,6 +177,6 @@ public interface JoinPoint {
     static String INITIALIZATION = "initialization";
     static String EXCEPTION_HANDLER = "exception-handler";
 
-    static String ADVICE_EXECUTION = "advice-execution"; //??? consider this vs. pcd
+    static String ADVICE_EXECUTION = "adviceexecution"; 
 
 }
index 6bf899a2201da07ad089cef45a326ca537ebc15b..a6fbc097bae1584bb535f1a90cd0a6f497021c85 100644 (file)
@@ -15,6 +15,7 @@
 package org.aspectj.runtime.reflect;
 
 import java.lang.reflect.Method;
+import java.util.StringTokenizer;
 
 import org.aspectj.lang.reflect.AdviceSignature;
 
@@ -43,19 +44,30 @@ class AdviceSignatureImpl extends CodeSignatureImpl implements AdviceSignature {
     }
 
     protected String createToString(StringMaker sm) {
-        //XXX this signature needs a lot of work        
-        StringBuffer buf = new StringBuffer("ADVICE: ");
-        buf.append(sm.makeModifiersString(getModifiers()));
+        StringBuffer buf = new StringBuffer();
+//        buf.append(sm.makeModifiersString(getModifiers()));
         if (sm.includeArgs) buf.append(sm.makeTypeName(getReturnType()));
         if (sm.includeArgs) buf.append(" ");        
         buf.append(sm.makePrimaryTypeName(getDeclaringType(),getDeclaringTypeName()));
         buf.append(".");
-        buf.append(getName());        
+        buf.append(toAdviceName(getName()));        
         sm.addSignature(buf, getParameterTypes());
         sm.addThrows(buf, getExceptionTypes());
         return buf.toString();
     }
     
+    private String toAdviceName(String methodName) {
+               if (methodName.indexOf('$') == -1) return methodName;
+               StringTokenizer strTok = new StringTokenizer(methodName,"$");
+               while (strTok.hasMoreTokens()) {
+                       String token = strTok.nextToken();
+                       if ( token.startsWith("before") ||
+                                token.startsWith("after") ||
+                                token.startsWith("around") ) return token;                        
+               }
+               return methodName;
+    }
+    
     /* (non-Javadoc)
         * @see org.aspectj.runtime.reflect.MemberSignatureImpl#createAccessibleObject()
         */
index a2a1122c0ac32a2f4bce4630c72b1fa3c4b9b920..941bc822f6321da984c3961458efede56a52dea7 100644 (file)
@@ -16,6 +16,8 @@ package org.aspectj.runtime.reflect;
 
 import java.lang.reflect.Modifier;
 
+import org.aspectj.lang.JoinPoint;
+
 class StringMaker {
     boolean shortTypeNames = true;
     boolean includeArgs = true;