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

JLS spec for DA is not conservative

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 5.0
    • Component/s: specification
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      5.0
    • CPU:
      generic
    • OS:
      solaris_8
    • Verification:
      Not verified

      Description

      The JLS spec for definite assignment is
      not conservative. The following program (noted in the jacks test
      suite) is required to be accepted by
      a compiler but it reads an uninitialized variable and
      therefore cannot verify.
      The jacks test suite requires a compiler to reject this
      code, but I'm not sure under what JLS clause it could do
      so.

              void m(int i) {
                  switch (i) {
                     case 0:
                      final int j;
                      j = 1;
                      class Local {
                          int k = j;
                      }
                      break;
                     case 1:
                      // Javac 1.4 compiles this, and causes a VerifyError
                      int k = new Local().k;
                  }
              }
             }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                abuckley Alex Buckley
                Reporter:
                gafter Neal Gafter
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: