-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4ca13f
commit 536c674
Showing
93 changed files
with
5,583 additions
and
694 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...oling/src/main/java/datadog/trace/agent/tooling/bytebuddy/matcher/ScalaTraitMatchers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package datadog.trace.agent.tooling.bytebuddy.matcher; | ||
|
||
import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.named; | ||
import static net.bytebuddy.matcher.ElementMatchers.is; | ||
import static net.bytebuddy.matcher.ElementMatchers.isMethod; | ||
import static net.bytebuddy.matcher.ElementMatchers.isStatic; | ||
import static net.bytebuddy.matcher.ElementMatchers.not; | ||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument; | ||
import static net.bytebuddy.matcher.ElementMatchers.takesArguments; | ||
|
||
import net.bytebuddy.description.method.MethodDescription; | ||
import net.bytebuddy.description.type.TypeDescription; | ||
import net.bytebuddy.matcher.ElementMatcher; | ||
|
||
public class ScalaTraitMatchers { | ||
public static ElementMatcher.Junction<MethodDescription> isTraitMethod( | ||
String traitName, String name, Object... argumentTypes) { | ||
|
||
ElementMatcher.Junction<MethodDescription> scalaOldArgs = | ||
isStatic() | ||
.and(takesArguments(argumentTypes.length + 1)) | ||
.and(takesArgument(0, named(traitName))); | ||
ElementMatcher.Junction<MethodDescription> scalaNewArgs = | ||
not(isStatic()).and(takesArguments(argumentTypes.length)); | ||
|
||
for (int i = 0; i < argumentTypes.length; i++) { | ||
Object argumentType = argumentTypes[i]; | ||
ElementMatcher<? super TypeDescription> matcher; | ||
if (argumentType instanceof ElementMatcher) { | ||
matcher = (ElementMatcher<? super TypeDescription>) argumentType; | ||
} else if (argumentType instanceof String) { | ||
matcher = named((String) argumentType); | ||
} else if (argumentType instanceof Class) { | ||
matcher = is((Class<?>) argumentType); | ||
} else { | ||
throw new IllegalArgumentException("Unexpected type for argument type specification"); | ||
} | ||
scalaOldArgs = scalaOldArgs.and(takesArgument(i + 1, matcher)); | ||
scalaNewArgs = scalaNewArgs.and(takesArgument(i, matcher)); | ||
} | ||
|
||
return isMethod().and(named(name)).and(scalaOldArgs.or(scalaNewArgs)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../datadog/trace/instrumentation/akkahttp/appsec/MultipartUnmarshallersInstrumentation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../java/datadog/trace/instrumentation/akkahttp/appsec/SprayUnmarshallerInstrumentation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 2 additions & 33 deletions
35
...p-10.0/src/main/java/datadog/trace/instrumentation/akkahttp/iast/TraitMethodMatchers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.