RFR 8193033 remove terminally deprecated sun.misc.Unsafe.defineClass

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR 8193033 remove terminally deprecated sun.misc.Unsafe.defineClass

Paul Sandoz
Hi,

Please review this patch to remove sun.misc.Unsafe.defineClass in 11.

There has been much outreach, by Alan and the Jigsaw team, about its public replacement MethodHandles.Lookup.defineClass.

CSR is here:

  https://bugs.openjdk.java.net/browse/JDK-8199699

Thanks,
Paul.


diff -r 3c0a12972165 src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
--- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Thu Mar 15 08:11:01 2018 -0700
+++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Thu Mar 15 09:51:00 2018 -0700
@@ -811,25 +811,6 @@
     /// random trusted operations from JNI:
 
     /**
-     * Tells the VM to define a class, without security checks.  By default, the
-     * class loader and protection domain come from the caller's class.
-     *
-     * @deprecated Use {@link java.lang.invoke.MethodHandles.Lookup#defineClass MethodHandles.Lookup#defineClass}
-     * to define a class to the same class loader and in the same runtime package
-     * and {@linkplain java.security.ProtectionDomain protection domain} of a
-     * given {@code Lookup}'s {@linkplain java.lang.invoke.MethodHandles.Lookup#lookupClass() lookup class}.
-     *
-     * @see java.lang.invoke.MethodHandles.Lookup#defineClass(byte[])
-     */
-    @Deprecated(since="9", forRemoval=true)
-    @ForceInline
-    public Class<?> defineClass(String name, byte[] b, int off, int len,
-                                ClassLoader loader,
-                                ProtectionDomain protectionDomain) {
-        return theInternalUnsafe.defineClass(name, b, off, len, loader, protectionDomain);
-    }
-
-    /**
      * Defines a class but does not make it known to the class loader or system dictionary.
      * <p>
      * For each CP entry, the corresponding CP patch must either be null or have
Reply | Threaded
Open this post in threaded view
|

Re: RFR 8193033 remove terminally deprecated sun.misc.Unsafe.defineClass

chris.hegarty

> On 15 Mar 2018, at 17:06, Paul Sandoz <[hidden email]> wrote:
>
> Hi,
>
> Please review this patch to remove sun.misc.Unsafe.defineClass in 11.
>
> There has been much outreach, by Alan and the Jigsaw team, about its public replacement MethodHandles.Lookup.defineClass.
>
> CSR is here:
>
>  https://bugs.openjdk.java.net/browse/JDK-8199699

Looks good Paul.   I don’t think that a CSR is strictly needed, but does no harm.

-Chris.

> Thanks,
> Paul.
>
>
> diff -r 3c0a12972165 src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
> --- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Thu Mar 15 08:11:01 2018 -0700
> +++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Thu Mar 15 09:51:00 2018 -0700
> @@ -811,25 +811,6 @@
>     /// random trusted operations from JNI:
>
>     /**
> -     * Tells the VM to define a class, without security checks.  By default, the
> -     * class loader and protection domain come from the caller's class.
> -     *
> -     * @deprecated Use {@link java.lang.invoke.MethodHandles.Lookup#defineClass MethodHandles.Lookup#defineClass}
> -     * to define a class to the same class loader and in the same runtime package
> -     * and {@linkplain java.security.ProtectionDomain protection domain} of a
> -     * given {@code Lookup}'s {@linkplain java.lang.invoke.MethodHandles.Lookup#lookupClass() lookup class}.
> -     *
> -     * @see java.lang.invoke.MethodHandles.Lookup#defineClass(byte[])
> -     */
> -    @Deprecated(since="9", forRemoval=true)
> -    @ForceInline
> -    public Class<?> defineClass(String name, byte[] b, int off, int len,
> -                                ClassLoader loader,
> -                                ProtectionDomain protectionDomain) {
> -        return theInternalUnsafe.defineClass(name, b, off, len, loader, protectionDomain);
> -    }
> -
> -    /**
>      * Defines a class but does not make it known to the class loader or system dictionary.
>      * <p>
>      * For each CP entry, the corresponding CP patch must either be null or have

Reply | Threaded
Open this post in threaded view
|

Re: RFR 8193033 remove terminally deprecated sun.misc.Unsafe.defineClass

Mandy Chung
In reply to this post by Paul Sandoz
+1

Mandy

On 3/15/18 10:06 AM, Paul Sandoz wrote:

> Hi,
>
> Please review this patch to remove sun.misc.Unsafe.defineClass in 11.
>
> There has been much outreach, by Alan and the Jigsaw team, about its public replacement MethodHandles.Lookup.defineClass.
>
> CSR is here:
>
>    https://bugs.openjdk.java.net/browse/JDK-8199699
>
> Thanks,
> Paul.
>
>
> diff -r 3c0a12972165 src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
> --- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Thu Mar 15 08:11:01 2018 -0700
> +++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Thu Mar 15 09:51:00 2018 -0700
> @@ -811,25 +811,6 @@
>       /// random trusted operations from JNI:
>  
>       /**
> -     * Tells the VM to define a class, without security checks.  By default, the
> -     * class loader and protection domain come from the caller's class.
> -     *
> -     * @deprecated Use {@link java.lang.invoke.MethodHandles.Lookup#defineClass MethodHandles.Lookup#defineClass}
> -     * to define a class to the same class loader and in the same runtime package
> -     * and {@linkplain java.security.ProtectionDomain protection domain} of a
> -     * given {@code Lookup}'s {@linkplain java.lang.invoke.MethodHandles.Lookup#lookupClass() lookup class}.
> -     *
> -     * @see java.lang.invoke.MethodHandles.Lookup#defineClass(byte[])
> -     */
> -    @Deprecated(since="9", forRemoval=true)
> -    @ForceInline
> -    public Class<?> defineClass(String name, byte[] b, int off, int len,
> -                                ClassLoader loader,
> -                                ProtectionDomain protectionDomain) {
> -        return theInternalUnsafe.defineClass(name, b, off, len, loader, protectionDomain);
> -    }
> -
> -    /**
>        * Defines a class but does not make it known to the class loader or system dictionary.
>        * <p>
>        * For each CP entry, the corresponding CP patch must either be null or have

Reply | Threaded
Open this post in threaded view
|

Re: RFR 8193033 remove terminally deprecated sun.misc.Unsafe.defineClass

Alan Bateman
In reply to this post by Paul Sandoz
On 15/03/2018 17:06, Paul Sandoz wrote:

> Hi,
>
> Please review this patch to remove sun.misc.Unsafe.defineClass in 11.
>
> There has been much outreach, by Alan and the Jigsaw team, about its public replacement MethodHandles.Lookup.defineClass.
>
> CSR is here:
>
>    https://bugs.openjdk.java.net/browse/JDK-8199699
>
Looks good, I assume the import of java.security.ProtectionDomain can be
removed too.

-Alan
Reply | Threaded
Open this post in threaded view
|

Re: RFR 8193033 remove terminally deprecated sun.misc.Unsafe.defineClass

Paul Sandoz


> On Mar 15, 2018, at 10:39 AM, Alan Bateman <[hidden email]> wrote:
>
> On 15/03/2018 17:06, Paul Sandoz wrote:
>> Hi,
>>
>> Please review this patch to remove sun.misc.Unsafe.defineClass in 11.
>>
>> There has been much outreach, by Alan and the Jigsaw team, about its public replacement MethodHandles.Lookup.defineClass.
>>
>> CSR is here:
>>
>>   https://bugs.openjdk.java.net/browse/JDK-8199699
>>
> Looks good, I assume the import of java.security.ProtectionDomain can be removed too.
>

Yes, thanks,
Paul.