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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: repo-valhalla
    • Fix Version/s: repo-valhalla
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      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

        Attachments

          Activity

            People

            Assignee:
            sadayapalam Srikanth Adayapalam
            Reporter:
            sadayapalam Srikanth Adayapalam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: