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

definite assignment after ! problem

XMLWordPrintable

    • 1.1
    • sparc
    • generic
    • Not verified



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

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

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

      Test: compilation of the following test

      public class test
      {
      public static void main()
      {
      boolean b;
      boolean r = false;
      boolean f = false;

      if (!(f || (b = r)))
      r = !b;
      System.out.println(r);
      }
      }

      produces such diagnostics:

      novo40% javac test.java
      test.java:10: 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: