RFR 8161947 runtime/Unsafe/GetUnsafe.java is failing on jdk9/dev

David Holmes david.holmes at oracle.com
Thu Jul 21 12:37:21 UTC 2016


Hi Paul,

On 21/07/2016 9:40 PM, Paul Sandoz wrote:
> Hi,
>
> The fix for:
>
>   https://bugs.openjdk.java.net/browse/JDK-8161129
>   8161129 Unsafe::getUnsafe should allow the platform class loader to access it
>
> broke a test in the Hotspot repo test area that i did not realize existed. That test can be deleted. There is an existing test in the JDK repo test area that tests the same functionality in sun.misc.Unsafe, which is arguably the right location, i have renamed that test.
>
> Paul.
>
> Hotspot test changes
>>
> diff -r 9f5a448947a4 test/runtime/Unsafe/GetUnsafe.java
> --- a/test/runtime/Unsafe/GetUnsafe.java	Wed Jul 20 14:47:53 2016 +0300
> +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
> @@ -1,45 +0,0 @@
> -/*
> - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
> - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
> - *
> - * This code is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU General Public License version 2 only, as
> - * published by the Free Software Foundation.
> - *
> - * This code is distributed in the hope that it will be useful, but WITHOUT
> - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
> - * version 2 for more details (a copy is included in the LICENSE file that
> - * accompanied this code).
> - *
> - * You should have received a copy of the GNU General Public License version
> - * 2 along with this work; if not, write to the Free Software Foundation,
> - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
> - *
> - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
> - * or visit www.oracle.com if you need additional information or have any
> - * questions.
> - */
> -
> -/*
> - * @test
> - * @summary Verifies that getUnsafe() actually throws SecurityException when unsafeAccess is prohibited.
> - * @library /testlibrary
> - * @modules java.base/jdk.internal.misc
> - * @run main GetUnsafe
> - */
> -
> -import jdk.internal.misc.Unsafe;
> -import static jdk.test.lib.Asserts.*;
> -
> -public class GetUnsafe {
> -    public static void main(String args[]) throws Exception {
> -        try {
> -            Unsafe unsafe = Unsafe.getUnsafe();
> -        } catch (SecurityException e) {
> -            // Expected
> -            return;
> -        }
> -        throw new RuntimeException("Did not get expected SecurityException");
> -    }
> -}

Removal looks fine.

>
> JDK test changes
>>
> diff --git a/test/sun/misc/Safe.java b/test/sun/misc/GetSunMiscUnsafe.java
> rename from test/sun/misc/Safe.java
> rename to test/sun/misc/GetSunMiscUnsafe.java
> --- a/test/sun/misc/Safe.java
> +++ b/test/sun/misc/GetSunMiscUnsafe.java
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2001, 2016 Oracle and/or its affiliates. All rights reserved.

Comma needed after 2016

I'll leave the body of the test to core-libs folk.

Thanks,
David
-----


>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -29,7 +29,7 @@
>   */
>
>
> -public class Safe {
> +public class GetSunMiscUnsafe {
>
>      public static void main(String[] args) throws Exception {
>          try {
>
>


More information about the core-libs-dev mailing list