-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Use package to suppress warning for entitlement self-test #128223
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
Conversation
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
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.
LGTM
I agree, in the long run we should have a single mechanism for log suppression, but for now this fixes the immediate issue (it's not worse than what we have today and it works).
💔 Backport failed
You can use sqren/backport to manually backport by running |
…128248) * Use package to suppress warning for entitlement self-test * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]>
|
(We're backporting it after all, in #128304.) |
…8223) * Use package to suppress warning for entitlement self-test * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]>
…128304) * Use package to suppress warning for entitlement self-test * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]>
…128304) (#128313) * Use package to suppress warning for entitlement self-test * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]>
Background
To avoid emitting an unnecessary error for the entitlement self-test, we specifically avoided logging when the caller class was
EntitlementSelfTester.Since #127877, we no longer ignore frames for method references, and so the caller class for an entitlement check is the class of the method reference itself, rather than the class in which that method reference was written.
As a consequence, the caller class for the self test is no longer
EntitlementSelfTester, but rather the class of the method reference.Fix
Suppress based on
Packageinstead ofClass. This suppresses entitlement warnings for theorg.elasticsearch.bootstrappackage.Alternatives
We could suppress this warning as we do for other warnings, by configuring log levels. That might be what we want to do for the long term. For the time being, this is a simple PR that allows us to remove our logging workarounds.
We could attempt to determine the enclosing class from the method reference object, but I haven't yet found any way to do so.
getDeclaringClassandgetEnclosingClassboth return null.