On Thu, 16 Dec 2021 21:04:58 GMT, liach <d...@openjdk.java.net> wrote:
> Simply changes this to only read the static field once to prevent `null` on > second read. src/java.base/share/classes/java/lang/Class.java line 3828: > 3826: java.security.AccessController.doPrivileged > 3827: (new > ReflectionFactory.GetReflectionFactoryAction()); > 3828: } p.s. If using an early return, I'd have it return early in the case reflectionFactory was not-null. then fall through to compute and assign the factory and return it. var factory = reflectionFactory; if (factory != null) { return factory; } return reflectionFactory = java.security.AccessController.doPrivileged (new ReflectionFactory.GetReflectionFactoryAction()); ------------- PR: https://git.openjdk.java.net/jdk/pull/6870