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

dasg10702m[021,111,311].html: JLS16.2.13 no definitely assigned val after try

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.3.0
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      generic, sparc
    • OS:
      generic, solaris_2.5.1
    • Verification:
      Verified

      Description

      The following new tests have been added to the JCK. Compiling this
      test should result in a compile-time error; however they all compile
      successfully with the new compiler (jdk1.3d). Since this problem was
      not observed in jdk1.2, the new behaviour represents a regression.

      lang/DASG/dasg107/dasg10702m021/dasg10702m021.html
      lang/DASG/dasg107/dasg10702m111/dasg10702m111.html
      lang/DASG/dasg107/dasg10702m311/dasg10702m311.html

      The following are simplifications of those tests:

      FILE: DefAssignAFtreTry1.java

      class E1 extends Exception {}
      class E2 extends Exception {}

      public class DefAssignAfterTry1 {
          public static void main(String argv[]) {
      boolean t = true;
      E1 se1 = new E1();
      E2 se2 = new E2();
      int i;
      try {
      if (t) {
      throw se1;
      }
      } catch (E1 e) {
      i = 0;
      }
      System.out.println(i);
      System.out.println("Error : there should be compile-time errors");
          }
      }

      FILE: DefAssignAFtreTry2.java

      class E1 extends Exception {}
      class E2 extends Exception {}

      public class DefAssignAfterTry2 {
          public static void main(String argv[]) {
      boolean t = true;
      E1 se1 = new E1();
      E2 se2 = new E2();
      // {
      int i;
      try {
      if (t) {
      i = 0;
      throw se1;
      } else {
      throw se2;
      }
      } catch (E1 e) {
      } catch (E2 e) {
      i = 0;
      }
      System.out.println(i);
      // }
      System.out.println("Error : there should be compile-time errors");
          }
      }


      FILE: DefAssignAFtreTry3.java

      class E1 extends Exception {}
      class E2 extends Exception {}

      public class DefAssignAfterTry3 {
          public static void main(String argv[]) {
      boolean t = true;
      E1 se1 = new E1();
      E2 se2 = new E2();

      int i;
      try {
      i = 0;
      if (t)
      throw se1;
      else
      throw se2;
      } catch (E1 e) {
      } catch (E2 e) {
      i = 0;
      }
      System.out.println(i);
      System.out.println("Error : there should be compile-time errors");
          }
      }

      iris.garcia@eng 1999-05-21


      Name: ssC76496 Date: 07/28/99


      Verified in JDK1.3-L. The error occurs in JDK1.3-L build.
      Try3.java:21: variable i might not have been initialized
              System.out.println(i);
                                 ^
      1 error

      ###@###.###

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: