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

Reference to final variable in inner class gives 'may not have been initialized'

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • tools
    • sparc
    • solaris_2.6



      Name: tb29552 Date: 06/10/98


      public class C { // slight variation of Bug Id 4056774
          C() {
      o = null;
          }
          class R {
      void printo() {
      System.out.println(o);
      }
          }
          private final Object o;
      }

      Compiling the above produces the error message:
      C.java:10: Blank final variable 'o' may not have
      been initialized. It must be assigned a value in
      an initializer, or in every constructor.
      (Review ID: 33093)
      ======================================================================

            Unassigned Unassigned
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: