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

DA status undefined for captured variables

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 1.4.0
    • specification
    • None
    • 5.0
    • generic
    • solaris_8
    • Not verified

      The status of the following program is undefined. This is one area
      of difference in behavior between jikes and javac that is tested
      for by the JCK test suite. Is this program allowed? Please update
      the specification to make it clear.

      public class dasg17302 {
          public static void main(String args[]) {
              new dasg17302().test();
          }

          void test() {
              final int k;
              class I {
                  int i = k; // error: k might be unassigned
              }
              { k = 5;}
              int i = new I().i;
          }
      }

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: