You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/02/18 14:49:33 UTC

[GitHub] [skywalking] lsyf commented on issue #4379: Fix ehcache:  missing interceptor of private constructor and setName method

lsyf commented on issue #4379: Fix ehcache:  missing interceptor of private constructor and setName method
URL: https://github.com/apache/skywalking/pull/4379#issuecomment-587496796
 
 
   > I think this fix needs to be improved. The reason of `#clone` not working is not caused by it is a private method, it is because the original intercept rule is targeting construct with specific parameter.
   > 
   > Notice this
   > 
   > ```java
   >     @Override
   >     public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
   >         return new ConstructorInterceptPoint[] {
   >             new ConstructorInterceptPoint() {
   >                 @Override
   >                 public ElementMatcher<MethodDescription> getConstructorMatcher() {
   >                     return takesArgument(0, named("net.sf.ehcache.config.CacheConfiguration"));
   >                 }
   > 
   >                 @Override
   >                 public String getConstructorInterceptor() {
   >                     return CONSTRUCTOR_CLASS_INTERCEPT_CLASS;
   >                 }
   >             }
   >         };
   >     }
   > ```
   > 
   > So basically, the better fix solution is add another constructor interceptor point to target the private constructor, I assume this one `private Cache(Cache original) throws CloneNotSupportedException`?
   > 
   > @lsyf What do you think?
   
   yes. Beacause the purpose of the interceptor is to save cache name,`#setName`  also need to be intercepted

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services