On Fri, 9 Apr 2021 13:45:03 GMT, Roger Riggs <rri...@openjdk.org> wrote:
>> src/java.naming/share/classes/com/sun/jndi/ldap/LdapPoolManager.java line >> 401: >> >>> 399: return AccessController.doPrivileged( >>> 400: (PrivilegedAction<String>) () -> >>> System.getProperty(propName, defVal) >>> 401: ); >> >> If you want to avoid the cast then you could create the PrivilegedAction >> explicitly, e.g. >> >> PrivilegedAction<String> pa = () -> System.getProperty(propName, defVal); >> return AccessController.doPrivileged(pa); > > An alternative here would be to use > sun.security.action.privilegedGetProperty(prop, default). > The package is already exported from java.base to java.desktop, etc. That is a very neat alternative yes. Approaching the problem like that especially improves the readability [JdkLDAP.java](https://github.com/openjdk/jdk/pull/3416/files#diff-bf4c67da93cf2b9196508db2d57f7e01bc884f2268f5bfd43a9f01dfd55e4955) in my opinion. I don't think casting has any major performance hits for these fixes, so is your suggestion mostly for readability's sake? ------------- PR: https://git.openjdk.java.net/jdk/pull/3416