Skip to content
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

Merged
merged 3 commits into from Mar 29, 2019

Conversation

shubhamugare
Copy link
Contributor

@shubhamugare shubhamugare commented Mar 9, 2019

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.

/** Contains error message string to be displayed and the message type from {@link MessageTypes}. */
public class ErrorMessage {

static Config config;
static NullAway nullAway;
Copy link
Collaborator

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.

Copy link
Contributor Author

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.
  

Copy link
Collaborator

@msridhar msridhar left a 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;
Copy link
Collaborator

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

Copy link
Contributor Author

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;
Copy link
Collaborator

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

Copy link
Contributor Author

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";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@lazaroclapp
Copy link
Collaborator

Not a full review, but, eyeballing it, it looks fine to me, except the PR title/commit message has a typo: "Mesaage".

@shubhamugare shubhamugare changed the title Refactor for Error Mesaage class use Refactor for Error Message class use Mar 12, 2019
@shubhamugare
Copy link
Contributor Author

Not a full review, but, eyeballing it, it looks fine to me, except the PR title/commit message has a typo: "Mesaage".

Oops! 😅

@lazaroclapp
Copy link
Collaborator

Hey @msridhar , do you have any unaddressed comments on this PR? I glanced at it and the refactor makes sense to me, given all tests pass, maybe worth merging it before #291 ? And releasing 0.7.0 with both?

Copy link
Collaborator

@msridhar msridhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@msridhar
Copy link
Collaborator

Hey @msridhar , do you have any unaddressed comments on this PR? I glanced at it and the refactor makes sense to me, given all tests pass, maybe worth merging it before #291 ? And releasing 0.7.0 with both?

Sounds good

@lazaroclapp lazaroclapp merged commit 18b386a into uber:master Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants