-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Disallow mutable array use as a constant #10604
Conversation
0a3e98b
to
6524fbe
Compare
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class TextRcFileEncoding | ||
implements RcFileEncoding | ||
{ | ||
public static final byte[] DEFAULT_SEPARATORS = new byte[] { | ||
private static final byte[] DEFAULT_SEPARATORS = new byte[] { |
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 we consider using ImmutableList instead?
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.
Generally yes, but the byte[] is used in other places, so that would be a bigger change, and maybe not warranted in this particular case
Build is green. Will resolve conflict and merge. |
Arrays are mutable, so are not suitable for public static fields.
The checks disabled are WARN level by default. Disable them altogether, for the benefit of anyone who cares to look at the Error Prone output, for whatever reason.
6524fbe
to
9892e61
Compare
Arrays are mutable, so are not suitable for public static fields.