Skip to content

False Positive for PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS #444

@feckertson

Description

@feckertson
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,

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions