Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7005821

lint warning for boolean assignment in if/loop condition

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Rejected
    • Icon: P4 P4
    • None
    • 7
    • tools
    • generic
    • generic

      CR 6978122 provides an example in which the user is surprised that "if (a = null) ___" compiles when a has type Boolean. Mistaking "=" for "==" is a common error, and the use of the former in a condition is almost always a mistake. It would be useful to provide a lint warning for such cases (both where the type is Boolean and the type is boolean).

      Note that Eclipse has such a warning.

            Unassigned Unassigned
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: