Skip to content

False negatives on DMI_USELESS_SUBSTRING #1928

@gloNelson

Description

@gloNelson

Hi,
I found false negatives on DMI_USELESS_SUBSTRING when using SpotBugs to analyze my project.

DMI_USELESS_SUBSTRING: This code invokes substring(0) on a String, which returns the original value.

String testDMI_USELESS_SUBSTRING(int index){
    StringBuilder sb = new StringBuilder();
    sb.append("}");
    return sb.substring(0);
}

Similar to #1927, it seems that SpotBugs does not do the same analysis on the StringBuilder class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions