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

inability of detection of definite assignment after the boolean

XMLWordPrintable

    • 1.1
    • sparc
    • generic
    • Not verified



      Name: ###@###.### Date: 09/05/96

      a variable is not considered as definitely assigned after the
                   boolean negation when false though it is definitely assigned
                   after its operand when true. This contradicts the following
                   assertion:

                   V is definitely assigned after !a when false iff V is definitely
                   assigned after a when true. (Java Language Specification,
                   section 16.1.5)

      Test: compilation of the following test

      public class test
      {
      public static void main()
      {
      boolean b;
      boolean r = true;
      boolean t = true;

      if (!(t && (b = r)));
      else
      r = !b;
      System.out.println(r);
      }
      }

      produces such diagnostics:

      novo40% javac test.java
      test.java:11: Variable b may not have been initialized.
      r = !b;
      ^
      1 error

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

            fyellinsunw Frank Yellin (Inactive)
            wensunw Wen Wen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: