terrymanu commented on a change in pull request #12448:
URL: https://github.com/apache/shardingsphere/pull/12448#discussion_r709154279
##########
File path:
shardingsphere-agent/shardingsphere-agent-core/src/main/java/org/apache/shardingsphere/agent/core/bytebuddy/transformer/ShardingSphereTransformer.java
##########
@@ -112,27 +113,13 @@
}
private Builder<?> interceptorClassStaticMethodPoint(final TypeDescription
description, final List<ClassStaticMethodPoint> classStaticMethodAroundPoints,
final Builder<?> builder) {
- List<ShardingSphereTransformationPoint<? extends
ClassStaticMethodAroundInterceptor>> classStaticMethodAdvicePoints =
description.getDeclaredMethods().stream()
+ List<ShardingSphereTransformationPoint<?>>
classStaticMethodAdvicePoints = description.getDeclaredMethods().stream()
.filter(each -> each.isStatic() && !(each.isAbstract() ||
each.isSynthetic()))
- .map(md -> {
- List<ClassStaticMethodPoint> classStaticMethodPoints =
classStaticMethodAroundPoints.stream().filter(point ->
point.getMatcher().matches(md)).collect(Collectors.toList());
- if (classStaticMethodPoints.isEmpty()) {
- return null;
- }
- if (classStaticMethodPoints.size() == 1) {
- return new ShardingSphereTransformationPoint<>(md, new
ClassStaticMethodAroundInterceptor(pluginLoader.getOrCreateInstance(classStaticMethodPoints.get(0).getAdvice())));
- } else {
- Collection<ClassStaticMethodAroundAdvice>
classStaticMethodAroundAdvices = classStaticMethodPoints.stream()
- .map(ClassStaticMethodPoint::getAdvice)
- .map(advice -> (ClassStaticMethodAroundAdvice)
pluginLoader.getOrCreateInstance(advice))
- .collect(Collectors.toList());
- return new ShardingSphereTransformationPoint<>(md, new
ComposeClassStaticMethodAroundInterceptor(classStaticMethodAroundAdvices));
- }
- })
+ .map(md -> getStaticClassTransformationPoint(md,
classStaticMethodAroundPoints))
Review comment:
What is `md`? Is it better to change another name?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]