Definite unassignment problem with try/catch

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 1.2.0
    • Affects Version/s: 1.1.1, 1.1.4
    • Component/s: tools
    • None
    • 1.2beta4
    • generic, x86
    • generic, windows_95
    • Not verified



      Name: tb29552 Date: 07/30/97


      Reported by: "Roly Perera" <###@###.###>

      In the following code, x is a blank final. Javac allows it to
      be assigned twice:

      void f() {
          final int x;

          try {
              x = 4;
              throw new Exception();
          }
          catch (Exception e) {
              x = 5; // ???
          }
      }

      See a longer example in the Comments section.

      ======================================================================

      Another example (final variable is also static), from 4094677:

      class X {
        static final int i ;
        static {
           try{
             i = 3;
             throw new Throwable();
           }catch(Throwable thb) { i = 4;}
        }

        public static void main( String[] argv ) {
          X ox = new X();
          System.out.println(ox.i);
        }
      }

      william.maddox@Eng 1997-11-21

            Assignee:
            William Maddox (Inactive)
            Reporter:
            Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: