On Sun, 17 Nov 2024 20:59:29 GMT, Phil Race <p...@openjdk.org> wrote:
>> Update 21 desktop module shared implementation files to remove doPrivileged. >> All the usual tests still pass. > > Phil Race has updated the pull request incrementally with one additional > commit since the last revision: > > 8344061 Changes requested by aivanov (Reviewer). src/java.desktop/share/classes/sun/awt/AppContext.java line 521: > 519: // Create a thread that belongs to the thread group > associated > 520: // with the AppContext and invokes EventQueue.postEvent. > 521: Thread thread = new Thread(r); Previously, the thread was created in the app context thread group and the properties of the created thread were modified, such as its priority and daemon flag. https://github.com/openjdk/jdk/blob/d76b5b888e15b507631068f508e261cab75c841e/src/java.desktop/share/classes/sun/awt/AppContext.java#L559-L563 src/java.desktop/share/classes/sun/awt/FontConfiguration.java line 163: > 161: } catch (Exception e) { > 162: } > 163: return exists.booleanValue(); Suggestion: try { File f = new File(fileName); return f.exists(); } catch (Exception e) { return false; } In this case, no variable is need. If you prefer to have the variable, it can now be of primitive type `boolean`. Can an exception be thrown at all? Neither `new File` nor `f.exists()` throw a checked exception. src/java.desktop/share/classes/sun/font/CreatedFontTracker.java line 1: > 1: /* The following imports are unused now: import java.security.AccessController; import java.security.PrivilegedAction; src/java.desktop/share/classes/sun/font/FileFont.java line 38: > 36: import sun.java2d.DisposerRecord; > 37: > 38: import java.io.IOException; `java.io.IOException` is unused now. src/java.desktop/share/classes/sun/font/SunFontManager.java line 1705: > 1703: f = new File(pathDirs[p] + File.separator + s); > 1704: if (f.exists()) { > 1705: path = f.getAbsolutePath(); This can now be return f.getAbsolutePath(); Then `path` variable can be removed. ------------- PR Review: https://git.openjdk.org/jdk/pull/22161#pullrequestreview-2443244947 PR Review Comment: https://git.openjdk.org/jdk/pull/22161#discussion_r1847001461 PR Review Comment: https://git.openjdk.org/jdk/pull/22161#discussion_r1846985440 PR Review Comment: https://git.openjdk.org/jdk/pull/22161#discussion_r1847022204 PR Review Comment: https://git.openjdk.org/jdk/pull/22161#discussion_r1847024301 PR Review Comment: https://git.openjdk.org/jdk/pull/22161#discussion_r1846971254