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

DA versus switch: javac allows reference to uninitialized variable

XMLWordPrintable

    • mantis
    • generic
    • solaris_8
    • Verified

      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;
              }
          }
      }

            gafter Neal Gafter (Inactive)
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: