RFR: 8048199: Replace anonymous inner classes with lambdas, where applicable, in JNDI
rriggs at openjdk.java.net
Fri Apr 9 16:33:10 UTC 2021
On Fri, 9 Apr 2021 15:47:35 GMT, Conor Cleary <ccleary at openjdk.org> wrote:
>> src/java.naming/share/classes/com/sun/jndi/ldap/LdapPoolManager.java line 413:
>>> 411: return AccessController.doPrivileged(
>>> 412: (PrivilegedAction<Long>) () -> Long.getLong(propName, defVal).longValue()
>>> 413: );
>> And GetIntegerAction here. Though it only supports an int value.
> Thanks for the suggestion Roger, I think the `privilegedGetProperty(prop, default)` for the `getProperty()` method looks great.
> WRT to using it for `getInt()` and `getLong()`, I think its reasonable to use other means for these methods in the interest of consistency due to, as you pointed out, only `int` being supported. Would you think? Or would it be better to use the same means in all 3 methods?
Its a slippery slope that might require a bit more investigation to check the expected value sizes to see if a change to the number of bits in the value for each property might break something. Technical debt can take you down a rabbit hole. Quickest to just convert to the lamba as you proposed.
More information about the core-libs-dev