Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.dubbo.rpc.Invoker;

import static net.bytebuddy.matcher.ElementMatchers.declaresMethod;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.returns;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
Expand All @@ -57,7 +58,7 @@ public ElementMatcher<? super MethodDescription> getMethodMatcher() {
.and(takesArgument(0, named("org.apache.dubbo.rpc.Invoker")))
.and(takesArgument(1, named("org.apache.dubbo.rpc.Invocation")))
// makes sure we only instrument Dubbo 2.7.3+ which introduces this method
.and(returns(named("org.apache.dubbo.rpc.Result")
.and(returns(hasSuperType(named("org.apache.dubbo.rpc.Result"))
.and(declaresMethod(named("whenCompleteWithContext")
.and(takesArgument(0, named("java.util.function.BiConsumer")))))));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public ElementMatcher<? super MethodDescription> getMethodMatcher() {
return named("execute").and(returns(void.class)).and(takesArguments(Runnable.class))
.or(named("submit").and(returns(hasSuperType(is(Future.class)))).and(takesArguments(Runnable.class)))
.or(named("submit").and(returns(hasSuperType(is(Future.class)))).and(takesArguments(Runnable.class, Object.class)))
.or(named("schedule").and(returns(ScheduledFuture.class)).and(takesArguments(Runnable.class, long.class, TimeUnit.class)));
.or(named("schedule").and(returns(hasSuperType(is(ScheduledFuture.class)))).and(takesArguments(Runnable.class, long.class, TimeUnit.class)));
}
}

Expand Down Expand Up @@ -171,7 +171,7 @@ public static void onExit(@Nullable @Advice.Thrown Throwable thrown,
@Override
public ElementMatcher<? super MethodDescription> getMethodMatcher() {
return named("submit").and(returns(hasSuperType(is(Future.class)))).and(takesArguments(Callable.class))
.or(named("schedule").and(returns(ScheduledFuture.class)).and(takesArguments(Callable.class, long.class, TimeUnit.class)));
.or(named("schedule").and(returns(hasSuperType(is(ScheduledFuture.class)))).and(takesArguments(Callable.class, long.class, TimeUnit.class)));
}

}
Expand Down Expand Up @@ -233,7 +233,7 @@ public ElementMatcher<? super TypeDescription> getTypeMatcher() {
@Override
public ElementMatcher<? super MethodDescription> getMethodMatcher() {
return named("execute").and(returns(void.class)).and(takesArguments(ForkJoinTask.class))
.or(named("submit").and(returns(ForkJoinTask.class)).and(takesArguments(ForkJoinTask.class)))
.or(named("submit").and(returns(hasSuperType(is(ForkJoinTask.class)))).and(takesArguments(ForkJoinTask.class)))
.or(named("invoke").and(returns(Object.class)).and(takesArguments(ForkJoinTask.class)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ElementMatcher<? super TypeDescription> getTypeMatcher() {
@Override
public ElementMatcher<? super MethodDescription> getMethodMatcher() {
return named("sendAsync")
.and(returns(named("java.util.concurrent.CompletableFuture")))
.and(returns(hasSuperType(named("java.util.concurrent.CompletableFuture"))))
.and(takesArguments(3));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ElementMatcher<? super TypeDescription> getTypeMatcher() {

@Override
public ElementMatcher<? super MethodDescription> getMethodMatcher() {
return named("send").and(returns(named("java.net.http.HttpResponse")));
return named("send").and(returns(hasSuperType(named("java.net.http.HttpResponse"))));
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.nameEndsWith;
import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith;
import static net.bytebuddy.matcher.ElementMatchers.named;
Expand Down Expand Up @@ -108,6 +109,6 @@ public ElementMatcher<? super TypeDescription> getTypeMatcher() {

@Override
public ElementMatcher<? super MethodDescription> getMethodMatcher() {
return named("execute").and(returns(named("okhttp3.Response")));
return named("execute").and(returns(hasSuperType(named("okhttp3.Response"))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public ElementMatcher<? super TypeDescription> getTypeMatcher() {
public ElementMatcher<? super MethodDescription> getMethodMatcher() {
return isPublic()
.and(named("startAsync"))
.and(returns(named("javax.servlet.AsyncContext")))
.and(returns(hasSuperType(named("javax.servlet.AsyncContext"))))
.and(takesArguments(0)
.or(
takesArgument(0, named("javax.servlet.ServletRequest"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public ElementMatcher<? super TypeDescription> getTypeMatcher() {

@Override
public ElementMatcher<? super MethodDescription> getMethodMatcher() {
return named("getInputStream").and(returns(named("javax.servlet.ServletInputStream")));
return named("getInputStream")
.and(returns(hasSuperType(named("javax.servlet.ServletInputStream"))));
}

@Override
Expand Down