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

[lworld] Identity types that have no declaration sites fail to be IdentityObjects

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • repo-valhalla
    • repo-valhalla
    • tools
    • generic
    • generic

      JDK-8237069 defined two top interfaces viz InlineObject and IdentityObject and wires them into declared class types by implicit injection. This approach fails to cover Identity types that have no declaration sites: viz arrays.

      The following code:

      public class X {
          static class G<T> {}
          public static void main(String [] args) {
              Object [] oa = new X[] { new X() };
              if (!(oa instanceof IdentityObject))
                  throw new AssertionError("Arrays are broken");
              Object o = new G<String>();
              if (!(o instanceof IdentityObject))
                  throw new AssertionError("Parameterized type are broken");
          }
      }

      fails to compile with:

      X.java:5: error: incompatible types: Object[] cannot be converted to IdentityObject
              if (!(oa instanceof IdentityObject))
                    ^
      1 error

            sadayapalam Srikanth Adayapalam (Inactive)
            sadayapalam Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: