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

Remove sun.misc.Unsafe dependency from sun.nio.cs.StringUTF16

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Resolved In Build:
      b97

      Description

      Looks like the Compact Strings work inadvertently introduced a
      dependency on sun.misc.Unsafe. ( just temporary confusion with
      having two Unsafes until the jdk.unsupported module is defined )

      diff --git a/src/java.base/share/classes/sun/nio/cs/StringUTF16.java b/src/java.base/share/classes/sun/nio/cs/StringUTF16.java
      --- a/src/java.base/share/classes/sun/nio/cs/StringUTF16.java
      +++ b/src/java.base/share/classes/sun/nio/cs/StringUTF16.java
      @@ -25,8 +25,8 @@

      package sun.nio.cs;

      -import static sun.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET;
      -import static sun.misc.Unsafe.ARRAY_BYTE_INDEX_SCALE;
      +import static jdk.internal.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET;
      +import static jdk.internal.misc.Unsafe.ARRAY_BYTE_INDEX_SCALE;

      class StringUTF16 {

      @@ -35,5 +35,5 @@
                                    ARRAY_BYTE_BASE_OFFSET + ARRAY_BYTE_INDEX_SCALE * index * 2L);
          }

      - private static final sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
      + private static final jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                chegar Chris Hegarty
                Reporter:
                chegar Chris Hegarty
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: