Menu

#915 Check for oddness

closed-rejected
2
2017-10-22
2010-12-03
Anonymous
No

This code triggers a "Check for oddness that won't work for negative numbers" warning but i is always positive

public class FindBugsTester {
public static void main(String args[]){

    for \(int i = 1; i< args.length; i++\)\{
        if \(i%2 == 1\)\{  
            System.out.print\(""\);
        \}
    \}

\}

}

Discussion

  • Keith Lea

    Keith Lea - 2010-12-03
    • assigned_to: nobody --> wpugh
    • status: open --> open-accepted
     
  • William Pugh

    William Pugh - 2011-07-08

    Warning is valid, but not relevant. Determining if a value is non-negative is difficult, Warning is rank 17. Leaving as is for 2.0.

     
  • William Pugh

    William Pugh - 2011-07-08
    • priority: 5 --> 2
    • status: open-accepted --> open-postponed
     
  • Andrey Loskutov

    Andrey Loskutov - 2017-10-22
    • Status: open-postponed --> closed-rejected
     

Log in to post a comment.