[jdk17] RFR: 8269543: The warning for System::setSecurityManager should only appear once for each caller [v2]

Weijun Wang weijun at openjdk.java.net
Wed Jun 30 15:45:25 UTC 2021


On Wed, 30 Jun 2021 06:32:04 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> I hope this is uncommon but if that class is loaded by a `ClassLoader` again and again then it will be different each time. I'll investigate more.
>
> WeakHashMap<Class<?>, Boolean>, where the key is the caller, should be okay (assume synchronization of course). Even with applications that do call setSecurityManager then the map is probably going to be one entry. I wouldn't expect it is common to create custom class loaders that load code that sets a security manager, meaning it is more likely that the container sets the SM rather have each plugin/application/whatever try to set the system-wide SM.

Thanks. Switched to Class<?> as cache key. New commit pushed.

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

PR: https://git.openjdk.java.net/jdk17/pull/166


More information about the core-libs-dev mailing list