-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Spotbugs] Enable spotbugs in pulsar-metadata #9253
Conversation
@@ -26,11 +26,20 @@ | |||
@Data | |||
public class GetResult { | |||
|
|||
public GetResult(byte[] value, Stat stat){ | |||
this.value = value.clone(); |
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.
While I understand the immutability aspect, making 2 extra copies and allocations of the value array it's overkill for this scenario.
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.
Maybe we could make the value
public to solve this problem(EI_EXPOSE_REP
) and avoid copy, even though that would sacrifice immutability. What do you think?
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'm not super convinced in making the field public. GetResult
class is part of API so I'd rather keep that behind a getter method. An implementation might not store it directly as a byte[]
but instead convert that on demand.
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.
Can we instead ignore the warning for this case?
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.
Okay.
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
a6097eb
to
7613ed1
Compare
/pulsarbot run-failure-checks |
4 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
Fixes streamnative/pulsar#1797
Motivation
Enable spotbugs in module pulsar-metadata.