-
Notifications
You must be signed in to change notification settings - Fork 791
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
Enable PrivateConstructorForUtilityClass errorprone check #6427
Conversation
@SuppressWarnings({"PrivateConstructorForUtilityClass", "unused"}) | ||
public static class DemoServlet3Advice { |
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.
Maybe we could do
if (name.endsWith("Advice")) {
disable("PrivateConstructorForUtilityClass")
}
instead of suppressing this in every advice class? WDYT?
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.
unfortunately this doesn't work (the gradle block is only resolved once, not per class name)
but this suppression on all of the advice classes is sufficiently horrendous, so I went ahead and added a custom OtelPrivateConstructorForUtilityClass
check that ignores Advice classes
@@ -54,4 +54,6 @@ static boolean isLocalRoot(Context parentContext) { | |||
static Context store(Context context, Span span) { | |||
return context.with(KEY, span); | |||
} | |||
|
|||
private LocalRootSpan() {} |
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.
Oops 🙈
…etry#6427) * PrivateConstructorForUtilityClass * Advice * More advice * More * More advice * More * Spotless * Fix * Fix * Fix * A better solution * Revert * More * Fix * Spotless * Fix
…etry#6427) * PrivateConstructorForUtilityClass * Advice * More advice * More * More advice * More * Spotless * Fix * Fix * Fix * A better solution * Revert * More * Fix * Spotless * Fix
…etry#6427) * PrivateConstructorForUtilityClass * Advice * More advice * More * More advice * More * Spotless * Fix * Fix * Fix * A better solution * Revert * More * Fix * Spotless * Fix
Primarily motivated by having (mostly) same errorprone configuration/checks as the other Java repos.