I just had a case in which my execution pointcut explicitly targeted a JDK proxy. When logging the joinpoint during advice execution, the $ had been replaced by .. During LTW, the class name was still displayed correctly.
[AppClassLoader@18b4aac2] weaveinfo at Type 'jdk.proxy2.$Proxy92' (no debug info available)::0 Join point 'method-execution(long jdk.proxy2.$Proxy92.getCount())' in Type 'jdk.proxy2.$Proxy92' (no debug info available) advised by before advice from 'uk.vaent.aspect.MyAspect' (MyAspect.java) [with runtime test]
see also: uk\vaent\aspect\MyAspect.java::0
execution(long jdk.proxy2..Proxy92.getCount())
See? execution(long jdk.proxy2.$Proxy92.getCount()) during weaving, but execution(long jdk.proxy2..Proxy92.getCount()) during advice execution.
The root cause seems to be here:
|
String makeTypeName(Class<?> type, String typeName, boolean shortName) { |
|
if (type == null) return "ANONYMOUS"; |
|
if (type.isArray()) { |
|
Class<?> componentType = type.getComponentType(); |
|
return makeTypeName(componentType, componentType.getName(), shortName) + "[]"; |
|
} |
|
if (shortName) { |
|
return stripPackageName(typeName).replace('$', '.'); |
|
} else { |
|
return typeName.replace('$', '.'); |
|
} |
|
} |
What exactly is the reason for the .replace('$', '.')? This behaviour traces back to the initial version 23 years ago.
I just had a case in which my
executionpointcut explicitly targeted a JDK proxy. When logging the joinpoint during advice execution, the$had been replaced by.. During LTW, the class name was still displayed correctly.See?
execution(long jdk.proxy2.$Proxy92.getCount())during weaving, butexecution(long jdk.proxy2..Proxy92.getCount())during advice execution.The root cause seems to be here:
aspectj/runtime/src/main/java/org/aspectj/runtime/reflect/StringMaker.java
Lines 90 to 101 in 5813dd5
What exactly is the reason for the
.replace('$', '.')? This behaviour traces back to the initial version 23 years ago.