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

False Positive for PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS #444

Open
feckertson opened this issue May 31, 2023 · 0 comments
Open

False Positive for PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS #444

feckertson opened this issue May 31, 2023 · 0 comments

Comments

@feckertson
Copy link

public Whatever doIt() {
.....
  return thing.doIt();
....
 return thing.doIt(); //genrates PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS
}

These calls cannot possibly be redundant because they both exit the method meaning there can never be a situation where both of them execute.

The actual example is a Builder pattern where thing.doIt() is more like Thing.builder().....build()
and it is incorrect to declare a Thing.ThingBuilder thingBuilder = Thing.builder() and reuse it all over the place (without invoking thingBuilder().clear() before each reuse) which is what this checker would have one do,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants