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
Ensure castToNonNull insertion/removal suggested fixes do not remove comments #815
Conversation
Pull Request Test Coverage Report for Build #1185
💛 - Coveralls |
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.
Modulo the question below (and I also can't think of an example which would have any issues), this LGTM!
" static class Foo { @Nullable Object getObj() { return null; } }", | ||
" Object test1(Foo f) {", | ||
" return f", | ||
" // comment that should not be deleted", |
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 happens in the nonNullF = nullVal; // some comment
case? Just nonNullF = castToNonNull(nullVal); // some comment
, I assume?
Is there any case you can imagine where the comment ends up inside the castToNonNull(...)
call like here, but without a newline between the comment and )
?
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'll add a couple more tests. We could also have castToNonNull(f./* comment */getObj())
We now preserve the original source code of the AST node for which we are adding or removing a cast, ensuring that comments within the node are preserved.