Review request for JDK-8135251: Use Unsafe.defineAnonymousClass for loading Nashorn script code

Marcus Lagergren lagergren at gmail.com
Mon Sep 14 07:55:19 UTC 2015


ant test

Does it spit out warnings like e.g.

Temp.java:1: warning: Unsafe is internal proprietary API and may be removed in a future release
import sun.misc.Unsafe;
               ^
Temp.java:6: warning: Unsafe is internal proprietary API and may be removed in a future release
    private static Unsafe getUnsafe() {
                   ^
Temp.java:7: warning: Unsafe is internal proprietary API and may be removed in a future release
	return AccessController.doPrivileged(new PrivilegedAction<Unsafe>() {
	                                                          ^
Temp.java:9: warning: Unsafe is internal proprietary API and may be removed in a future release
                    public Unsafe run() {
                           ^
Temp.java:11: warning: Unsafe is internal proprietary API and may be removed in a future release
			final Field theUnsafeField = Unsafe.class.getDeclaredField("theUnsafe");
			                             ^
Temp.java:13: warning: Unsafe is internal proprietary API and may be removed in a future release
			return (Unsafe)theUnsafeField.get(null);
			        ^
Temp.java:21: warning: Unsafe is internal proprietary API and may be removed in a future release
    private static Unsafe UNSAFE = getUnsafe();
                   ^
7 warnings

Because we don’t want compile warnings ;-)

/M


> On 14 Sep 2015, at 09:54, Attila Szegedi <attila.szegedi at oracle.com> wrote:
> 
> What do you mean by “unsafe warning”?
> 
>> On Sep 13, 2015, at 12:47 PM, Marcus Lagergren <lagergren at gmail.com <mailto:lagergren at gmail.com>> wrote:
>> 
>> +1. Nicely done.
>> 
>> Does this compile without unsafe warnings, though?
>> 
>> /M
>> 
>>> On 11 Sep 2015, at 18:00, Attila Szegedi <attila.szegedi at oracle.com <mailto:attila.szegedi at oracle.com>> wrote:
>>> 
>>> e
>> 
> 



More information about the nashorn-dev mailing list