Questions on deprivileging a module
    Alan Bateman 
    Alan.Bateman at oracle.com
       
    Tue Jul  5 07:56:35 UTC 2016
    
    
  
On 05/07/2016 08:15, Wang Weijun wrote:
> :
> It's a runtime error.
>
> @CallerSensitive
> public static Unsafe getUnsafe() {
>      Class<?> caller = Reflection.getCallerClass();
>      if (!VM.isSystemDomainLoader(caller.getClassLoader()))
>          throw new SecurityException("Unsafe"); <<<<<< The exception thrown
>      return theUnsafe;
> }
>
> Just tried the one in jdk.unsupported, same error.
>
Okay, maybe this restriction in jdk.internal.misc.Unsafe needs to 
relaxed. For now then I assume you can read Unsafe.theUnsafe which is 
how user code typically gets it.
-Alan.
    
    
More information about the jigsaw-dev
mailing list