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

The idea of "V is definitely unassigned after e2" in "16.2.15 try Statements" of JLS3 is ambiguous

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7
    • 6
    • specification
    • None
    • rc
    • generic
    • generic
    • Verified

      The section "16.2.15 try Statements" of JLS3 contains the following sentence:
       *V is definitely unassigned after e2 in every statement of the form assert e1 : e2 that occurs in the try block.

      The question is : what is meant by "V is definitely unassigned after e2"? Is it the same as "V is definitly unassigned after assert statement" from section "16.2.8 assert Statements"?
      In other words I would like to know the conditions that must be met for V to be definitely unassigned after e2.

      Please, become familiar with the current behaviour of compilator in different cases:
      1) try{
             assert true: (V = 1);
          }catch(...) {
              V = 2;
          }
      Compilation completed successfully

      2) try{
             assert false: (V = 1);
          }catch(...) {
              V = 2;
          }
      1 error:
      variable V might already have been assigned

      3!) try{
             boolean e1;
             assert (e1 = true): (V = 1);
          }catch(...) {
              V = 2;
          }
      1 error:
      variable V might already have been assigned

            abuckley Alex Buckley
            ynovozhi Yulia Novozhilova (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: