You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: buildSrc/call-site-instrumentation-plugin/src/test/groovy/datadog/trace/plugin/csi/impl/assertion/AssertBuilder.groovy
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,10 @@ class AssertBuilder<C extends CallSiteAssert> {
59
59
return [null, null]
60
60
}
61
61
final isEnabled = type.getMethodsByName('isEnabled').first()
62
-
final returnStatement = isEnabled.body.get().statements.first.get().asReturnStmt()
62
+
// JavaParser's NodeList has method getFirst() returning an Optional, however with Java 21's
63
+
// SequencedCollection, Groovy picks the getFirst() that returns the object itself.
64
+
// Using `first()` rather than `first` picks the groovy method instead, fixing the situation.
65
+
final returnStatement = isEnabled.body.get().statements.first().asReturnStmt()
63
66
final enabledMethodCall = returnStatement.expression.get().asMethodCallExpr()
64
67
final enabled = resolveMethod(enabledMethodCall)
65
68
final enabledArgs = enabledMethodCall.getArguments().collect { it.asStringLiteralExpr().asString() }.toSet()
0 commit comments