-
Notifications
You must be signed in to change notification settings - Fork 295
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
Remove nullable annotation configuration in fix serialization. #621
Conversation
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.
Looks good to me and good refactoring/simplification. There is a missing comment to be deleted and a minor question, but otherwise looks good to me. Maybe worth testing this internally with a compatible version of the auto-annotator? Both to make sure all runs and to familiarize yourself with the process, @nimakarimipour .
/** Stores information suggesting a type change of an element in source code. */ | ||
public class SuggestedFixInfo { | ||
/** Stores information suggesting adding @Nullable on an element in source code. */ | ||
public class SuggestedNullableFixInfo { | ||
|
||
/** FixLocation of the target element in source code. */ | ||
private final FixLocation fixLocation; | ||
/** Error which will be resolved by this type change. */ | ||
private final ErrorMessage errorMessage; | ||
/** Suggested annotation. */ |
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.
Remove this comment as well.
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.
/** Stores information suggesting a type change of an element in source code. */ | ||
public class SuggestedFixInfo { | ||
/** Stores information suggesting adding @Nullable on an element in source code. */ | ||
public class SuggestedNullableFixInfo { |
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.
Why the rename here? It makes sense for now, but I wonder if we will have to flip it right back once we start adding other types of fixes? Or maybe the idea will be to add a common supertype for fixes and retain this one as a subclass?
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.
I did the renaming since instantiating this class only means we are suggesting Nullable
and the value Nullable
is hardcoded in this class. I though for better understanding the class purpose, I should refine the name.
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.
Sounds good for now. We might revisit this if we are adding other kinds of fixes, but right not it isn't clear if that will happen within NullAway or within the annotator or where, so this makes sense to me.
Thank you for your comment. Sure, will do that @lazaroclapp |
Hi @lazaroclapp, I checked this internally with a compatible version of Annotator. Everything is working correctly, this is ready for |
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.
Feel free to merge when/if test pass. But please make the commit title "Remove nullable annotation configuration in fix serialization" (rather than "Removes") and make sure the squashed commit description is the PR's description, not the list of individual commit messages, please :)
Following GH-517 If
serializeFixMetadata
is active,NullAway
will serialize suggested type changes (currently just adding@Nullable
). In theFixSerializationConfig
file we can set a custom annotation thatNullAway
will use in the output serializations.However, this process can be simplified by just asking
NullAway
to serialize type change locations with a default annotation name, any tool processing this output can use their own preferred annotation.After this PR the following entity will be removed from the config
.xml
file:And a sample out below:
Will be changed to simply: