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
Refactor for Error Message class use #284
Conversation
/** Contains error message string to be displayed and the message type from {@link MessageTypes}. */ | ||
public class ErrorMessage { | ||
|
||
static Config config; | ||
static NullAway nullAway; |
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.
No static fields please; they can lead to memory leaks and data races. Also we shouldn't be keeping a pointer to the NullAway
object here. We should pass in just the state that we need.
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.
Done 👍
Separated the code into new ErrorBuilder
class.
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.
Couple more nits, but overall looks great!
|
||
private final Config config; | ||
private final String checkerName; | ||
private final Set<String> allNames; |
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 is this field? Pls document
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.
👍Done
public class ErrorBuilder { | ||
|
||
private final Config config; | ||
private final String checkerName; |
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.
Should this be maybe suppressionName
? Looks like it's just used when generating a @SuppressWarnings
. Pls also add docs
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.
👍Done
@@ -48,8 +48,6 @@ | |||
|
|||
private final DataFlow dataFlow; | |||
|
|||
private static String OPTIONAL_PATH = "java.util.Optional"; |
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.
👍
Not a full review, but, eyeballing it, it looks fine to me, except the PR title/commit message has a typo: "Mesaage". |
Oops! 😅 |
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
Made following changes:
Moved all the methods which are related to creating error message to
ErrorBuilder
class.Used Error Message object as a parameter for
createErrorDescription
.Some minor nits.