#1282 False Positive with implicit String.valuesOf() (Java)

PMD-5.2.2
closed
None
PMD
3-Major
Bug
5.2.1
2015-02-12
2014-11-15
No

When testing this class:

package com.mycompany.mavenproject1;

import java.io.IOException;

public class NewClass {

    public void falsePositive(Boolean b) throws IOException {
        System.out.write(( "" + b ).getBytes());
    }
}

You get this result

pmd-bin-5.2.1/bin/run.sh pmd -d src/main/java/ -f text -R java-basic,java-design
/tmp/mavenproject1/src/main/java/com/mycompany/mavenproject1/NewClass.java:8:   Useless parentheses.

However the parentheses are needed.

Discussion

  • Andreas Dangel

    Andreas Dangel - 2014-11-15
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
    
     When testing this class:
    
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-Next
     
  • Andreas Dangel

    Andreas Dangel - 2014-11-15

    Will be fixed with the next version.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks