RFR: 8344337: SecurityManager cleanup in java.prefs module [v6]

Sean Mullan mullan at openjdk.org
Mon Nov 25 21:05:26 UTC 2024


On Mon, 25 Nov 2024 20:55:10 GMT, Brent Christian <bchristi at openjdk.org> wrote:

>> src/java.prefs/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java line 87:
>> 
>>> 85:     @SuppressWarnings("restricted")
>>> 86:     private static void loadPrefsLib() {
>>> 87:         System.loadLibrary("prefs");
>> 
>> What am I missing?  Why keep the private static method if it only contains a single method invocation and is only used in the static initializer?
>
> We want to `@SuppressWarnings("restricted")` the `loadLibrary()` call. IIUC, I can't `@SuppressWarnings` the static block, nor the call to `loadLibrary()`, so AFAICT that call needs to be in a separate, `@SuppressWarnings`-ed method.

Right. The other option is to put the annotation above the class definition which would cover the entire class, but I think this is better as it makes the annotation specific to that method only.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22252#discussion_r1857342129


More information about the core-libs-dev mailing list