[OpenJDK 2D-Dev] RFR: 8038875: Remove use of ServiceLoader in finding class implementing sun.java2d.pipe. RenderingEngine

Phil Race philip.race at oracle.com
Wed May 7 20:26:48 UTC 2014


On 5/7/14 12:40 PM, Mandy Chung wrote:
>
>>
>> You may consider to use the 3-arg version of Class.forName and not to 
>> initialize the class.  This is called within a doPrivileged block and 
>> it's generally a good convention to invoke the class initialization 
>> of the specified class (from the system property) outside the 
>> doPrivileged block.  Static analysis tool may consider catching the 
>> 1-arg version of Class.forName and flag it as a warning.
>
> The class will need to be initialized in the newInstance() call. The 
> above comment might not apply.   Is the doPrivileged block needed for 
> the RenderingEngine instantiation?  I was wondering if it was needed 
> for the service loader only or not.
>
>
Good question. A privilege is obviously needed for the getProperty but
the rest may not need it .. I can try removing it and see if anything 
breaks.

-phil.




More information about the 2d-dev mailing list