RFR: 8344060: Remove doPrivileged calls from shared implementation code in the java.desktop module : part 1 [v2]

Phil Race prr at openjdk.org
Fri Nov 15 20:21:44 UTC 2024


On Fri, 15 Nov 2024 10:26:05 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Since JEP 486 : Permanently Disable the Security Manager
>> [https://bugs.openjdk.org/browse/JDK-8338625] is now integrated, calls to java.security.AccessController.doPrivileged are obsolete and can be removed.
>> 
>> This PR takes care of some of the shared-platform files in the java.desktop module to have them removed.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove Suppresswarning

src/java.desktop/share/classes/sun/awt/image/ImageWatched.java line 138:

> 136:                 // My referent is null so we must prune in a second pass.
> 137:                 ret = true;
> 138:             } else if (update(myiw, img, info, x, y, w, h) == false) {

In other cases, I might not say this, but here enough has changed anyway that I will ..
update() is now a one-line method, called from just this one place.
I think you could delete it and directly call myiw.imageUpdate(img, info, x, y, w, h);

src/java.desktop/share/classes/sun/awt/image/ImagingLib.java line 91:

> 89:     static {
> 90: 
> 91:         System.loadLibrary("mlib_image");

why did you remove the try/catch ? Seems like a semantic change that should not be made.

Also this whole class has 
@SuppressWarnings({"removal", "restricted"})

I'm not sure I see anything else that is deprecated for removal, so doesn't it need to be updated ?

src/java.desktop/share/classes/sun/awt/util/PerformanceLogger.java line 90:

> 88: 
> 89:     static {
> 90:         String perfLoggingProp = System.getProperty("sun.perflog");

where's the removal of SuppressWarnings ?

src/java.desktop/share/classes/sun/java2d/opengl/OGLRenderQueue.java line 51:

> 49:          * which will not get GCed before VM exit.
> 50:          */
> 51:         flusher = new QueueFlusher();

looks like you  forgot to remove SuppressWarnings

src/java.desktop/share/classes/sun/print/PSPrinterJob.java line 342:

> 340: 
> 341:     private static void initStatic() {
> 342:         //enable privileges so initProps can access system properties,

This whole comment is obsolete.

src/java.desktop/share/classes/sun/print/RasterPrinterJob.java line 985:

> 983:         final GraphicsConfiguration gc = grCfg;
> 984: 
> 985:         PrintService service = getPrintService();

I'm fairly sure you missed removing a SuppressWarnings for this method

src/java.desktop/share/classes/sun/swing/JLightweightFrame.java line 108:

> 106:      */
> 107:     private static boolean copyBufferEnabled = "true".equals(
> 108:             System.getProperty("swing.jlf.copyBufferEnabled", "true"));

looks like you forgot to remove
import sun.security.action.GetPropertyAction;

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22133#discussion_r1844381493
PR Review Comment: https://git.openjdk.org/jdk/pull/22133#discussion_r1844382940
PR Review Comment: https://git.openjdk.org/jdk/pull/22133#discussion_r1844387309
PR Review Comment: https://git.openjdk.org/jdk/pull/22133#discussion_r1844392243
PR Review Comment: https://git.openjdk.org/jdk/pull/22133#discussion_r1844400524
PR Review Comment: https://git.openjdk.org/jdk/pull/22133#discussion_r1844406654
PR Review Comment: https://git.openjdk.org/jdk/pull/22133#discussion_r1844408813


More information about the client-libs-dev mailing list