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

Conor Cleary ccleary at openjdk.java.net
Tue Apr 13 10:04:20 UTC 2021


On Tue, 13 Apr 2021 09:34:15 GMT, Conor Cleary <ccleary at openjdk.org> wrote:

>> src/java.naming/share/classes/javax/naming/ldap/StartTlsRequest.java line 223:
>> 
>>> 221:      */
>>> 222:     private final ClassLoader getContextClassLoader() {
>>> 223:         PrivilegedAction<ClassLoader> pa = () -> Thread.currentThread().getContextClassLoader();
>> 
>> We can use here an instance method reference to beautify code a little bit more:
>> ```PrivilegedAction<ClassLoader> pa = Thread.currentThread()::getContextClassLoader;```
>
> Good idea, also would fit in with the style of the method just after, `priviligedHasNext()` as that also uses a functional interface.

Changes included as described in commit [5d6ecd3](https://github.com/openjdk/jdk/pull/3416/commits/5d6ecd31eb6ed2a63f17b2e798e83b91cb720075)

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

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


More information about the security-dev mailing list