Replacing Unsafe.allocateInstance
    Brian Goetz 
    brian.goetz at oracle.com
       
    Tue Jun 30 15:58:54 UTC 2015
    
    
  
> Mocking should be allowed for any class since any class can be mocked. Even
> the JDK ones
An understandable user perspective :)
Unfortunately, many serious security bugs can stem from being able to 
create a bogus instance of a JDK class that is loaded off the 
bootclasspath, and the existence of vectors for creating these exploits 
is a negative for the entire ecosystem.  So, we may need to make some 
tradeoffs between security and convenience.
(Many JDK APIs primarily expose interfaces anyway; these are easily 
mocked without magic.)
    
    
More information about the jdk9-dev
mailing list