-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-18356 Explicitly setting up instrumentation for inline mocking (Java 21+) #18339
base: trunk
Are you sure you want to change the base?
Conversation
build.gradle
Outdated
mockitoAgent { | ||
transitive = false | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not do this once for all projects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but not all projects need mockitoAgent
, eg ':test-common:test-common-runtime'
, ':group-coordinator:group-coordinator-api'
, so I think its better for configuring it for separate projects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the downside of enabling it for those projects and how many such projects exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The downside is these projects need to implement libs.mockitoCore
dependency which it doesn't need, and the following projects doesn't need it ':test-common:test-common-runtime'
, ':group-coordinator:group-coordinator-api'
, ':examples'
, ':generator'
, ':tools:tools-api'
, ':shell'
, ':streams:streams-scala'
, ':streams:examples'
, ':connect:transforms'
, ':connect:json'
, ':connect:mirror-client'
, ':connect:test-plugins'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we enable it automatically if the mockitoCore
dependency is added to a project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good idea, I will try for it :)
Jira: https://issues.apache.org/jira/browse/KAFKA-18356
Starting from Java 21, the JDK restricts the ability of libraries to attach a Java agent to their own JVM. As a result, the inline-mock-maker might not be able to function without an explicit setup to enable instrumentation, and the JVM will always display a warning.
The mockito document
Test in my local
trunk:
this branch:
Committer Checklist (excluded from commit message)