This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git


The following commit(s) were added to refs/heads/main by this push:
     new f0c22f3  Ignore the synthetic constructor created by the agent (#111)
f0c22f3 is described below

commit f0c22f32dd1493c03b01013ddac93e861902d153
Author: AlexQin <[email protected]>
AuthorDate: Wed Feb 16 18:09:09 2022 +0800

    Ignore the synthetic constructor created by the agent (#111)
    
    * Resolves #8532, ignored the synthetic constructor created by java agent
    
    Co-authored-by: qinjunjie <[email protected]>
---
 CHANGES.md                                                             | 1 +
 .../plugin/spring/patch/AutowiredAnnotationProcessorInterceptor.java   | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index bc7ddff..5ff2501 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -11,6 +11,7 @@ Release Notes.
 * Support Druid Connection pool metrics collecting.
 * Support HikariCP Connection pool metrics collecting.
 * Support Dbcp2 Connection pool metrics collecting.
+* Ignore the synthetic constructor created by the agent in the Spring patch 
plugin.
 
 #### Documentation
 
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/core-patch/src/main/java/org/apache/skywalking/apm/plugin/spring/patch/AutowiredAnnotationProcessorInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/core-patch/src/main/java/org/apache/skywalking/apm/plugin/spring/patch/AutowiredAnnotationProcessorInterceptor.java
index ac03a0b..24b4bdd 100644
--- 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/core-patch/src/main/java/org/apache/skywalking/apm/plugin/spring/patch/AutowiredAnnotationProcessorInterceptor.java
+++ 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/core-patch/src/main/java/org/apache/skywalking/apm/plugin/spring/patch/AutowiredAnnotationProcessorInterceptor.java
@@ -20,7 +20,6 @@ package org.apache.skywalking.apm.plugin.spring.patch;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -72,7 +71,7 @@ public class AutowiredAnnotationProcessorInterceptor 
implements InstanceMethodsA
                     Constructor<?>[] rawConstructor = 
beanClass.getDeclaredConstructors();
                     List<Constructor<?>> candidateRawConstructors = new 
ArrayList<Constructor<?>>();
                     for (Constructor<?> constructor : rawConstructor) {
-                        if (!Modifier.isPrivate(constructor.getModifiers())) {
+                        if (!constructor.isSynthetic()) {
                             candidateRawConstructors.add(constructor);
                         }
                     }

Reply via email to