RFR: 8048199: Replace anonymous inner classes with lambdas, where applicable, in JNDI

Conor Cleary ccleary at openjdk.java.net
Fri Apr 9 15:44:18 UTC 2021


On Fri, 9 Apr 2021 14:01:32 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> 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?
>
> Right, not a performance problem.  Just simpler to use an existing method to read a privileged property.
> And there will be one less doPriv.

I think I may change the PR to reflect what Alan suggested. Its more readable than the lambda-with-cast solution in that an action is created _and then_ an action is carried out as supposed to fitting it all into one call. Its also as concise.

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

PR: https://git.openjdk.java.net/jdk/pull/3416


More information about the core-libs-dev mailing list