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

Like Bug #4166933 JDK 1.2 wrongly reports

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.2.0
    • tools
    • generic
    • generic



      Name: igT44549 Date: 02/24/99

      =20
      This bug was reported as #4166933 f=FCr JDK 1.1.x. I found that
      something similar exists in JDK 1.2:

      Compiling the following code wrongly reports that
      "Blank final variable 's' may not have been initialized".

      This happens with both JDK 1.1.7 and JDK 1.2

      ---- cut here ----
      import javax.swing.JTable;
      import javax.swing.table.AbstractTableModel;

      public class Bug2 {
        private final String
          s;

        public Bug2() {
          s =3D "";
        }

        private class SubListe extends JTable {
          SubListe( ) {
            setModel( new AbstractTableModel() {
              public int getColumnCount() { return 0; }
              public int getRowCount() { return 0; }

      =09// replacing "Integer.class" by "null" or removing
      =09// the method fixes the problem!
              public Class getColumnClass( int iCol ) {
                return Integer.class;
              }

              public Object getValueAt( int iRow, int iCol ) {
                return null;
              };
            } );
          }
        }
      }

      ---- and here ----

      The strange thing is, that replacing "Integer.class" by "null"
      in the inner class or completely removing "getColumnClass"
      fixes the problem.

      I have another example that fails to compile with JDK 1.1.7, but
      compiles correctly with JDK 1.2:

      ---- cut here ----
      public class Bug {
        final String s;

        public static interface IF {
        }

        public Bug() {
          s =3D "";
        }
      }=20
      ---- and here ----

      so, it seems to become more complicated ;-)
      (Review ID: 48012)
      ======================================================================

            wmaddoxsunw William Maddox (Inactive)
            iris Iris Clark
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: