[jdk9] RFR 8181442 Deprecate sun.misc.Unsafe.defineClass

Mandy Chung mandy.chung at oracle.com
Wed Jun 7 18:39:51 UTC 2017


> On Jun 7, 2017, at 11:22 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> 
> Hi,
> 
> Please review:
> 
> diff -r ed1e99c1bba2 src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
> --- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java	Wed Jun 07 06:45:09 2017 -0700
> +++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java	Wed Jun 07 11:21:06 2017 -0700
> @@ -813,8 +813,15 @@
>     /**
>      * 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,
> 
> (CCC will be filed after review is complete.)


Looks good.

Mandy


More information about the core-libs-dev mailing list