Optimize Zero Length Array Instantiation With JDK Constant Value

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      Zero-length arrays are immutable values, therefore, it should be permissible to allow all zero-length arrays to compile with a constant value. For example, the compiler should maintain a single copy of an empty byte array and assign it to both b1, b2.

          byte b1[] = new byte[0];
          byte b2[] = new byte[0];
          if (System.identityHashCode(b1) != System.identityHashCode(b2)) {
            System.out.println("Different objects");
          }


            Assignee:
            Unassigned
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: