Inline assignments within while loop clause get no coverage

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Medium
    • long term roadmap
    • Affects Version/s: 3.0.2, 3.1.0, 3.2.0, 3.3.0, 4.0.0
    • Component/s: CEP Plugin, Reporting
    • None
    • Environment:

      Eclipse Helios, Vista 64bit

    • Severity 2 - Major

      This will work with any type of assignment:

      int i = 0;
      while ((i = i + 1) < 3)

      { System.out.println(i); }

      The "((i = i + 1) < 3)" will get no coverage with the mouseover hint being: "Expression evaluated to true 0 times, false 0 times."


      The following is no problem however:

      int i = 0;
      while ((++i) < 3) { System.out.println(i); }

      Here is another example that won't work:

      public static void inlineAssignment() {
      Class<?> c = Integer.class;
      while ((c = c.getSuperclass()) != null)

      { System.out.println(c); }

      }

      Since Clover is primarily a coverage tool, I marked this issue Major.

            Assignee:
            Unassigned
            Reporter:
            Benny Bottema
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: