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

DA versus switch: javac allows reference to uninitialized variable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.2
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      mantis
    • CPU:
      generic
    • OS:
      solaris_8
    • Verification:
      Verified

      Description

      javac allows the following code, generating a class file that does not verify.

      class T {
          public static void main(final String[] args) {
              {
                  final Object b;
                  b = null;
              }
              switch(args.length) {
              case 0:
                  int b;
                  break;
              case 1:
                  int c = b;
              }
          }
      }

        Attachments

          Activity

            People

            Assignee:
            gafter Neal Gafter
            Reporter:
            gafter Neal Gafter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: