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

[Spotbugs] Enable spotbugs in pulsar-metadata #9253

Merged
merged 5 commits into from
Jan 26, 2021

Conversation

RobertIndie
Copy link
Member

Fixes streamnative/pulsar#1797

Motivation

Enable spotbugs in module pulsar-metadata.

@@ -26,11 +26,20 @@
@Data
public class GetResult {

public GetResult(byte[] value, Stat stat){
this.value = value.clone();
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay.

@sijie sijie added this to the 2.8.0 milestone Jan 21, 2021
@sijie sijie added the type/cleanup Code or doc cleanups e.g. remove the outdated documentation or remove the code no longer in use label Jan 21, 2021
@RobertIndie
Copy link
Member Author

/pulsarbot run-failure-checks

2 similar comments
@RobertIndie
Copy link
Member Author

/pulsarbot run-failure-checks

@RobertIndie
Copy link
Member Author

/pulsarbot run-failure-checks

@RobertIndie RobertIndie force-pushed the spotbugs-pulsar-metadata branch from a6097eb to 7613ed1 Compare January 25, 2021 01:30
@RobertIndie
Copy link
Member Author

/pulsarbot run-failure-checks

4 similar comments
@RobertIndie
Copy link
Member Author

/pulsarbot run-failure-checks

@RobertIndie
Copy link
Member Author

/pulsarbot run-failure-checks

@RobertIndie
Copy link
Member Author

/pulsarbot run-failure-checks

@RobertIndie
Copy link
Member Author

/pulsarbot run-failure-checks

@sijie sijie merged commit 0223bb1 into apache:master Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/cleanup Code or doc cleanups e.g. remove the outdated documentation or remove the code no longer in use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable spotbugs in module pulsar-metadata
3 participants