Skip to content

Commit

Permalink
exclude synthetic methods
Browse files Browse the repository at this point in the history
  • Loading branch information
EddeCCC committed Sep 17, 2024
1 parent 3939d35 commit 88f80ed
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package rocks.inspectit.gepard.agent.state.scope;

import static net.bytebuddy.matcher.ElementMatchers.isSynthetic;
import static net.bytebuddy.matcher.ElementMatchers.not;

import java.util.*;
import java.util.stream.Collectors;
import net.bytebuddy.description.method.MethodDescription;
Expand Down Expand Up @@ -48,7 +51,11 @@ public Set<InstrumentationScope> getActiveScopes(String fullyQualifiedName) {
*/
public ElementMatcher.Junction<MethodDescription> getMethodMatcher(
Set<InstrumentationScope> scopes) {
if (containsAllMethodsScope(scopes)) return ElementMatchers.isMethod();
if (containsAllMethodsScope(scopes)) {
// Currently, we also exclude synthetic methods, since we cannot handle lambda expressions
// properly yet
return ElementMatchers.isMethod().and(not(isSynthetic()));
}

Set<String> methodNames = collectMethodNames(scopes);
return buildMatcherForMethods(methodNames);
Expand Down

0 comments on commit 88f80ed

Please sign in to comment.