ni-ze commented on a change in pull request #1875: Correct overriding parent
class methods,when method parameters have annotations.More details to see the
issue #1740
URL:
https://github.com/apache/incubator-skywalking/pull/1875#discussion_r230548676
##########
File path:
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/interceptor/enhance/ClassEnhancePluginDefine.java
##########
@@ -201,24 +204,26 @@
for (StaticMethodsInterceptPoint staticMethodsInterceptPoint :
staticMethodsInterceptPoints) {
String interceptor =
staticMethodsInterceptPoint.getMethodsInterceptor();
if (StringUtil.isEmpty(interceptor)) {
- throw new EnhanceException("no StaticMethodsAroundInterceptor
define to enhance class " + enhanceOriginClassName);
+ throw new EnhanceException("no StaticMethodsAroundInterceptor
define to enhance class " + typeDescription.getTypeName());
}
if (staticMethodsInterceptPoint.isOverrideArgs()) {
- newClassBuilder =
newClassBuilder.method(isStatic().and(staticMethodsInterceptPoint.getMethodsMatcher()))
- .intercept(
- MethodDelegation.withDefaultConfiguration()
- .withBinders(
- Morph.Binder.install(OverrideCallable.class)
- )
- .to(new
StaticMethodsInterWithOverrideArgs(interceptor))
- );
+ newClassBuilder =
newClassBuilder.method(not(isDeclaredBy(typeDescription))
Review comment:
Yes. If this class is a subclass and we want to enhance the method of
superclass's method,we will use it. this grammar will work when enhance the
subclass like com.mysql.jdbc.Driver which the "connect" method does noes
decleared by com.mysql.jdbc.Driver.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services